merge with mpm
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Mon, 11 Oct 2010 13:26:29 -0500
changeset 12705 d734b3470138
parent 12704 ca6e2adc3e4d (diff)
parent 12698 7aef77e74cf3 (current diff)
child 12706 9ca08fbb750a
child 12719 215ba8791f10
merge with mpm
mercurial/commands.py
--- a/mercurial/commands.py	Sun Oct 10 18:02:52 2010 -0500
+++ b/mercurial/commands.py	Mon Oct 11 13:26:29 2010 -0500
@@ -4316,7 +4316,7 @@
            _('remove (and delete) file even if added or modified')),
          ] + walkopts,
          _('[OPTION]... FILE...')),
-    "rename|mv":
+    "rename|move|mv":
         (rename,
          [('A', 'after', None, _('record a rename that has already occurred')),
           ('f', 'force', None,
--- a/mercurial/hgweb/protocol.py	Sun Oct 10 18:02:52 2010 -0500
+++ b/mercurial/hgweb/protocol.py	Mon Oct 11 13:26:29 2010 -0500
@@ -66,3 +66,10 @@
         sys.stdout, sys.stderr = p.oldio
         req.respond(HTTP_OK, HGTYPE)
         return ['%d\n%s' % (rsp.res, val)]
+    elif isinstance(rsp, wireproto.pusherr):
+        # drain the incoming bundle
+        req.drain()
+        sys.stdout, sys.stderr = p.oldio
+        rsp = '0\n%s\n' % rsp.res
+        req.respond(HTTP_OK, HGTYPE, length=len(rsp))
+        return [rsp]
--- a/mercurial/sshserver.py	Sun Oct 10 18:02:52 2010 -0500
+++ b/mercurial/sshserver.py	Mon Oct 11 13:26:29 2010 -0500
@@ -79,6 +79,9 @@
         self.sendresponse('')
         self.sendresponse(str(rsp.res))
 
+    def sendpusherror(self, rsp):
+        self.sendresponse(rsp.res)
+
     def serve_forever(self):
         try:
             while self.serve_one():
@@ -92,6 +95,7 @@
         str: sendresponse,
         wireproto.streamres: sendstream,
         wireproto.pushres: sendpushresponse,
+        wireproto.pusherr: sendpusherror,
     }
 
     def serve_one(self):
--- a/mercurial/wireproto.py	Sun Oct 10 18:02:52 2010 -0500
+++ b/mercurial/wireproto.py	Mon Oct 11 13:26:29 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)
@@ -281,15 +285,16 @@
         heads = repo.heads()
         return their_heads == ['force'] or their_heads == heads
 
+    proto.redirect()
+
     # 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-')
     fp = os.fdopen(fd, 'wb+')
     r = 0
-    proto.redirect()
     try:
         proto.getfile(fp)
         lock = repo.lock()
@@ -297,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)
@@ -310,7 +315,7 @@
                 sys.stderr.write("abort: %s\n" % inst)
         finally:
             lock.release()
-            return pushres(r)
+        return pushres(r)
 
     finally:
         fp.close()
--- a/tests/test-http-branchmap.t	Sun Oct 10 18:02:52 2010 -0500
+++ b/tests/test-http-branchmap.t	Mon Oct 11 13:26:29 2010 -0500
@@ -10,7 +10,7 @@
   $ hg -R a ci -Am foo
   adding foo
   $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
-  listening at http://localhost*:$HGPORT1/ (bound to 127.0.0.1:$HGPORT1) (glob)
+  listening at http://*:$HGPORT1/ (bound to 127.0.0.1:$HGPORT1) (glob)
   $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b
   requesting all changes
   adding changesets