changeset 22050:56ccd95b49c6

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 06 Aug 2014 00:50:53 -0700
parents 86c5318b8e5b
children e894de232f35
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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