changeset 2153:4c195eb4d2c5

push: add extra warning about pushing to old server Pushing using old method is slow and racy. We adds warning to point this to the user. We also add inline comment to clarify the function purpose.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 07 Mar 2017 14:59:00 +0100
parents b96ca1b51e04
children 92c2a54f98ee
files hgext3rd/evolve/obsexchange.py tests/test-simple4server.t
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obsexchange.py
+++ b/hgext3rd/evolve/obsexchange.py
@@ -60,6 +60,11 @@
             yield d
             d = self.read(4096)
 
+# compat-code: _pushobsolete
+#
+# the _pushobsolete function is a core function used to exchange
+# obsmarker with repository that does not support bundle2
+
 @eh.wrapfunction(exchange, '_pushobsolete')
 def _pushobsolete(orig, pushop):
     """utility function to push obsolete markers to a remote"""
@@ -78,6 +83,10 @@
         if not markers:
             obsexcmsg(repo.ui, "no marker to push\n")
         elif remote.capable('_evoext_pushobsmarkers_0'):
+            msg = ('the remote repository use years old versions of Mercurial'
+                   ' and evolve\npushing obsmarker using legacy method\n')
+            repo.ui.warn(msg)
+            repo.ui.warn('(please upgrade your server)\n')
             obsdata = pushobsmarkerStringIO()
             for chunk in obsolete.encodemarkers(markers, True):
                 obsdata.write(chunk)
@@ -89,6 +98,14 @@
             remote.evoext_pushobsmarkers_0(obsdata)
             obsexcprg(repo.ui, None)
         else:
+            # XXX core could be able do the same things but without the debug
+            # and progress output.
+            msg = ('the remote repository usea years old version of Mercurial'
+                   ' and not evolve extension\n')
+            repo.ui.warn(msg)
+            msg = 'pushing obsmarker using and extremely slow legacy method\n'
+            repo.ui.warn(msg)
+            repo.ui.warn('(please upgrade your server and enable evolve.serveronly on it)\n')
             rslts = []
             remotedata = _pushkeyescape(markers).items()
             totalbytes = sum(len(d) for k, d in remotedata)
--- a/tests/test-simple4server.t
+++ b/tests/test-simple4server.t
@@ -108,6 +108,9 @@
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files (+1 heads)
+  the remote repository use years old versions of Mercurial and evolve
+  pushing obsmarker using legacy method
+  (please upgrade your server)
   pushing 2 obsolescence markers (* bytes) (glob)
   remote: 2 obsolescence markers added
   $ cat ../errors.log