Mercurial > evolve
changeset 1503:e8f7e4c53537 stable
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 | 5c962163f77a |
children | 415a51ac07a7 91b6a30424a3 |
files | README hgext/evolve.py |
diffstat | 2 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/README Mon Sep 14 13:23:43 2015 -0700 +++ b/README Mon Sep 14 13:48:34 2015 -0700 @@ -54,6 +54,7 @@ 5.2.1 -- - prune: fixed possible issue with lock and bookmark +- next/prev: fixed possible issue with lock and bookmark 5.2.0 -- 2015-06-25
--- a/hgext/evolve.py Mon Sep 14 13:23:43 2015 -0700 +++ b/hgext/evolve.py Mon Sep 14 13:48:34 2015 -0700 @@ -2004,11 +2004,15 @@ shouldmove = opts.get('move_bookmark') and bm is not None 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: @@ -2048,11 +2052,15 @@ shouldmove = opts.get('move_bookmark') and bm is not None 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: