# HG changeset patch # User Pierre-Yves David # Date 2014-08-06 07:50:53 # 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 --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4574,8 +4574,10 @@ def phase(ui, repo, *revs, **opts): 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 @@ def phase(ui, repo, *revs, **opts): 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