diff mercurial/wireproto.py @ 12703:40bb5853fc4b

wireproto: introduce pusherr() to deal with "unsynced changes" error The behaviour between http and ssh still differ: - the "unsynced changes" is seen as a remote output in the http cases - but it is correctly seen as a push error for ssh
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 11 Oct 2010 12:45:36 -0500
parents f747c085b789
children 6c375e07d673
line wrap: on
line diff
--- a/mercurial/wireproto.py	Mon Oct 11 12:44:33 2010 -0500
+++ b/mercurial/wireproto.py	Mon Oct 11 12:45:36 2010 -0500
@@ -142,6 +142,10 @@
     def __init__(self, res):
         self.res = res
 
+class pusherr(object):
+    def __init__(self, res):
+        self.res = res
+
 def dispatch(repo, proto, command):
     func, spec = commands[command]
     args = proto.getargs(spec)
@@ -285,7 +289,7 @@
 
     # fail early if possible
     if not check_heads():
-        return 'unsynced changes'
+        return pusherr('unsynced changes')
 
     # write bundle data to temporary file because it can be big
     fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
@@ -298,7 +302,7 @@
             if not check_heads():
                 # someone else committed/pushed/unbundled while we
                 # were transferring data
-                return 'unsynced changes'
+                return pusherr('unsynced changes')
 
             # push can proceed
             fp.seek(0)