mq: use ui.allowemptycommit to allow empty commits
authorDurham Goode <durham@fb.com>
Mon, 11 May 2015 17:51:22 -0700
changeset 25019 672e0558aed1
parent 25018 93e015a3d1ea
child 25020 747055706e85
mq: use ui.allowemptycommit to allow empty commits Previously, mq used the force flag to allow empty commits. Now that we have ui.allowemptycommit let's switch to that instead. We can't completely remove the force flag since it is used for a bunch of other behavior in localrepo.commit.
hgext/mq.py
--- a/hgext/mq.py	Mon May 11 16:18:28 2015 -0700
+++ b/hgext/mq.py	Mon May 11 17:51:22 2015 -0700
@@ -376,14 +376,17 @@
         if repo.ui.configbool('mq', 'secret', False):
             phase = phases.secret
     if phase is not None:
-        backup = repo.ui.backupconfig('phases', 'new-commit')
+        phasebackup = repo.ui.backupconfig('phases', 'new-commit')
+    allowemptybackup = repo.ui.backupconfig('ui', 'allowemptycommit')
     try:
         if phase is not None:
             repo.ui.setconfig('phases', 'new-commit', phase, 'mq')
+        repo.ui.setconfig('ui', 'allowemptycommit', True)
         return repo.commit(*args, **kwargs)
     finally:
+        repo.ui.restoreconfig(allowemptybackup)
         if phase is not None:
-            repo.ui.restoreconfig(backup)
+            repo.ui.restoreconfig(phasebackup)
 
 class AbortNoCleanup(error.Abort):
     pass