hgext/evolve.py
branchstable
changeset 1742 970a4c13ebc3
parent 1741 8c05184672ae
child 1743 299cdaa24fa5
--- a/hgext/evolve.py	Sat Oct 08 08:14:21 2016 -0700
+++ b/hgext/evolve.py	Sun Oct 16 09:52:53 2016 -0700
@@ -2221,10 +2221,13 @@
     """update to parent revision
 
     Displays the summary line of the destination for clarity."""
-    if True:
+    wlock = None
+    dryrunopt = opts['dry_run']
+    if not dryrunopt:
+        wlock = repo.wlock()
+    try:
         wkctx = repo[None]
         wparents = wkctx.parents()
-        dryrunopt = opts['dry_run']
         if len(wparents) != 1:
             raise error.Abort('merge in progress')
         if not opts['merge']:
@@ -2254,7 +2257,6 @@
                 ret = hg.update(repo, p.rev())
                 if not ret:
                     tr = lock = None
-                    wlock = repo.wlock()
                     try:
                         lock = repo.lock()
                         tr = repo.transaction('previous')
@@ -2265,7 +2267,8 @@
                             bmdeactivate(repo)
                         tr.close()
                     finally:
-                        lockmod.release(tr, lock, wlock)
+                        lockmod.release(tr, lock)
+
             displayer.show(p)
             return 0
         else:
@@ -2273,6 +2276,8 @@
                 displayer.show(p)
             ui.warn(_('multiple parents, explicitly update to one\n'))
             return 1
+    finally:
+        lockmod.release(wlock)
 
 @command('^next',
          [('B', 'move-bookmark', False,
@@ -2290,10 +2295,13 @@
 
     Displays the summary line of the destination for clarity.
     """
-    if True:
+    wlock = None
+    dryrunopt = opts['dry_run']
+    if not dryrunopt:
+        wlock = repo.wlock()
+    try:
         wkctx = repo[None]
         wparents = wkctx.parents()
-        dryrunopt = opts['dry_run']
         if len(wparents) != 1:
             raise error.Abort('merge in progress')
         if not opts['merge']:
@@ -2323,7 +2331,6 @@
                 ret = hg.update(repo, c.rev())
                 if not ret:
                     lock = tr = None
-                    wlock = repo.wlock()
                     try:
                         lock = repo.lock()
                         tr = repo.transaction('next')
@@ -2334,7 +2341,7 @@
                             bmdeactivate(repo)
                         tr.close()
                     finally:
-                        lockmod.release(tr, lock, wlock)
+                        lockmod.release(tr, lock)
             displayer.show(c)
             result = 0
         elif children:
@@ -2376,6 +2383,8 @@
                 return result
             return 1
         return result
+    finally:
+        lockmod.release(wlock)
 
 def _reachablefrombookmark(repo, revs, bookmarks):
     """filter revisions and bookmarks reachable from the given bookmark