next/prev: properly lock repo before touching bookmarks
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 14 Sep 2015 13:48:34 -0700
changeset 1502 094b54a72c1d
parent 1500 b4dfafda72c2
child 1504 415a51ac07a7
next/prev: properly lock repo before touching bookmarks
hgext/evolve.py
--- a/hgext/evolve.py	Thu Sep 10 16:24:50 2015 -0400
+++ b/hgext/evolve.py	Mon Sep 14 13:48:34 2015 -0700
@@ -2018,11 +2018,15 @@
         else:
             ret = hg.update(repo, p.rev())
             if not ret:
-                if shouldmove:
-                    repo._bookmarks[bm] = p.node()
-                    repo._bookmarks.write()
-                else:
-                    bmdeactivate(repo)
+                wlock = repo.wlock()
+                try:
+                    if shouldmove:
+                        repo._bookmarks[bm] = p.node()
+                        repo._bookmarks.write()
+                    else:
+                        bmdeactivate(repo)
+                finally:
+                    wlock.release()
         displayer.show(p)
         return 0
     else:
@@ -2069,11 +2073,15 @@
         else:
             ret = hg.update(repo, c.rev())
             if not ret:
-                if shouldmove:
-                    repo._bookmarks[bm] = c.node()
-                    repo._bookmarks.write()
-                else:
-                    bmdeactivate(repo)
+                wlock = repo.wlock()
+                try:
+                    if shouldmove:
+                        repo._bookmarks[bm] = c.node()
+                        repo._bookmarks.write()
+                    else:
+                        bmdeactivate(repo)
+                finally:
+                    wlock.release()
         displayer.show(c)
         result = 0
     elif children: