mq: use the newcommitphase utility
authorBoris Feld <boris.feld@octobus.net>
Mon, 09 Oct 2017 17:33:03 +0200
changeset 40107 c2d2e18f97004a81b08b22d6e9961f3714d7693a
parent 40106 fe6125ebdf91f5e7a5d4a3e772700faeb4511051
child 40108 1faa34347b247d710b4207ad8a95d744c5c9b3ea
push id573
push usergszorc@mozilla.com
push dateWed, 18 Oct 2017 21:03:35 +0000
mq: use the newcommitphase utility We use the official API instead of doing the operation manually. This will help storing the default value for phases properly in the next changeset.
hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1060,17 +1060,17 @@ class queue(object):
         # Manually trigger phase computation to ensure phasedefaults is
         # executed before we remove the patches.
         repo._phasecache
         patches = self._revpatches(repo, sorted(revs))
         qfinished = self._cleanup(patches, len(patches))
         if qfinished and repo.ui.configbool('mq', 'secret'):
             # only use this logic when the secret option is added
             oldqbase = repo[qfinished[0]]
-            tphase = repo.ui.config('phases', 'new-commit', phases.draft)
+            tphase = phases.newcommitphase(repo.ui)
             if oldqbase.phase() > tphase and oldqbase.p1().phase() <= tphase:
                 with repo.transaction('qfinish') as tr:
                     phases.advanceboundary(repo, tr, tphase, qfinished)
 
     def delete(self, repo, patches, opts):
         if not patches and not opts.get('rev'):
             raise error.Abort(_('qdelete requires at least one revision or '
                                'patch name'))