diff mercurial/localrepo.py @ 15952:ec8a9e06cf05 stable

mq-safety: don't apply safety on non-outgoing changeset When mq changeset are secret, they don't appear in outgoing and won't be pushed. So it's not necessary to abort the push. The checkpush call is protected by lock to prevent race on phase.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 20 Jan 2012 18:45:29 +0100
parents b8696a6676be
children 5653f2d166ea
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Jan 20 00:27:11 2012 +0100
+++ b/mercurial/localrepo.py	Fri Jan 20 18:45:29 2012 +0100
@@ -1597,14 +1597,14 @@
         # unbundle assumes local user cannot lock remote repo (new ssh
         # servers, http servers).
 
-        self.checkpush(force, revs)
-        lock = None
-        unbundle = remote.capable('unbundle')
-        if not unbundle:
-            lock = remote.lock()
+        # get local lock as we might write phase data
+        locallock = self.lock()
         try:
-            # get local lock as we might write phase data
-            locallock = self.lock()
+            self.checkpush(force, revs)
+            lock = None
+            unbundle = remote.capable('unbundle')
+            if not unbundle:
+                lock = remote.lock()
             try:
                 # discovery
                 fci = discovery.findcommonincoming
@@ -1687,10 +1687,10 @@
                             self.ui.warn(_('updating %s to public failed!\n')
                                             % newremotehead)
             finally:
-                locallock.release()
+                if lock is not None:
+                    lock.release()
         finally:
-            if lock is not None:
-                lock.release()
+            locallock.release()
 
         self.ui.debug("checking for updated bookmarks\n")
         rb = remote.listkeys('bookmarks')