comparison hgext/evolve.py @ 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
comparison
equal deleted inserted replaced
1501:5c962163f77a 1503:e8f7e4c53537
2002 p = parents[0] 2002 p = parents[0]
2003 bm = bmactive(repo) 2003 bm = bmactive(repo)
2004 shouldmove = opts.get('move_bookmark') and bm is not None 2004 shouldmove = opts.get('move_bookmark') and bm is not None
2005 ret = hg.update(repo, p.rev()) 2005 ret = hg.update(repo, p.rev())
2006 if not ret: 2006 if not ret:
2007 if shouldmove: 2007 wlock = repo.wlock()
2008 repo._bookmarks[bm] = p.node() 2008 try:
2009 repo._bookmarks.write() 2009 if shouldmove:
2010 else: 2010 repo._bookmarks[bm] = p.node()
2011 bmdeactivate(repo) 2011 repo._bookmarks.write()
2012 else:
2013 bmdeactivate(repo)
2014 finally:
2015 wlock.release()
2012 displayer.show(p) 2016 displayer.show(p)
2013 return 0 2017 return 0
2014 else: 2018 else:
2015 for p in parents: 2019 for p in parents:
2016 displayer.show(p) 2020 displayer.show(p)
2046 c = children[0] 2050 c = children[0]
2047 bm = bmactive(repo) 2051 bm = bmactive(repo)
2048 shouldmove = opts.get('move_bookmark') and bm is not None 2052 shouldmove = opts.get('move_bookmark') and bm is not None
2049 ret = hg.update(repo, c.rev()) 2053 ret = hg.update(repo, c.rev())
2050 if not ret: 2054 if not ret:
2051 if shouldmove: 2055 wlock = repo.wlock()
2052 repo._bookmarks[bm] = c.node() 2056 try:
2053 repo._bookmarks.write() 2057 if shouldmove:
2054 else: 2058 repo._bookmarks[bm] = c.node()
2055 bmdeactivate(repo) 2059 repo._bookmarks.write()
2060 else:
2061 bmdeactivate(repo)
2062 finally:
2063 wlock.release()
2056 displayer.show(c) 2064 displayer.show(c)
2057 result = 0 2065 result = 0
2058 elif children: 2066 elif children:
2059 ui.warn("ambigious next changeset:\n") 2067 ui.warn("ambigious next changeset:\n")
2060 for c in children: 2068 for c in children: