mercurial/exchange.py
changeset 20436 2f2e8d1c4856
parent 20435 46ede894d5a4
child 20437 9e54faf37ff8
--- a/mercurial/exchange.py	Thu Jan 30 19:55:09 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 20:00:34 2014 -0800
@@ -33,6 +33,8 @@
         self.revs = revs
         # allow push of new branch
         self.newbranch = newbranch
+        # did a local lock get acquired?
+        self.locallocked = None
 
 def push(repo, remote, force=False, revs=None, newbranch=False):
     '''Push outgoing changesets (limited by revs) from a local
@@ -66,7 +68,7 @@
     unfi = pushop.repo.unfiltered()
     def localphasemove(nodes, phase=phases.public):
         """move <nodes> to <phase> in the local source repo"""
-        if locallock is not None:
+        if pushop.locallocked:
             phases.advanceboundary(pushop.repo, phase, nodes)
         else:
             # repo is not locked, do not change any phases!
@@ -81,7 +83,9 @@
     locallock = None
     try:
         locallock = pushop.repo.lock()
+        pushop.locallocked = True
     except IOError, err:
+        pushop.locallocked = False
         if err.errno != errno.EACCES:
             raise
         # source repo cannot be locked.