Patchwork [3,of,4,V2] mq: use ui.allowemptycommit to allow empty commits

login
register
mail settings
Submitter Durham Goode
Date May 12, 2015, 3:29 a.m.
Message ID <17cc5e344169e24cf5af.1431401352@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/9023/
State Accepted
Headers show

Comments

Durham Goode - May 12, 2015, 3:29 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1431391882 25200
#      Mon May 11 17:51:22 2015 -0700
# Node ID 17cc5e344169e24cf5af7900f3b3bbd00993f24b
# Parent  37ef345236b146ffc75a6414411ffb6bea870a74
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.

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -376,14 +376,17 @@  def newcommit(repo, phase, *args, **kwar
         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