# HG changeset patch # User Pierre-Yves David # Date 1407311453 25200 # Node ID 56ccd95b49c6a494d915183ce348c22bcfe42703 # Parent 86c5318b8e5b60e8d3e763cc364297aef415f881 phase: wrap `hg phases` phase movement in a transaction Phases are not yet inside the transaction, but we need to prepare for it. So we wrap the phase movement inside a transaction. diff -r 86c5318b8e5b -r 56ccd95b49c6 mercurial/commands.py --- a/mercurial/commands.py Wed Aug 06 00:50:07 2014 -0700 +++ b/mercurial/commands.py Wed Aug 06 00:50:53 2014 -0700 @@ -4574,8 +4574,10 @@ ctx = repo[r] ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr())) else: + tr = None lock = repo.lock() try: + tr = repo.transaction("phase") # set phase if not revs: raise util.Abort(_('empty revision set')) @@ -4584,7 +4586,10 @@ phases.advanceboundary(repo, targetphase, nodes) if opts['force']: phases.retractboundary(repo, targetphase, nodes) + tr.close() finally: + if tr is not None: + tr.release() lock.release() # moving revision from public to draft may hide them # We have to check result on an unfiltered repository