Mercurial > hg > evolve
changeset 1598:094b54a72c1d
next/prev: properly lock repo before touching bookmarks
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 14 Sep 2015 13:48:34 -0700 |
parents | b4dfafda72c2 |
children | 415a51ac07a7 |
files | hgext/evolve.py |
diffstat | 1 files changed, 18 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -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: