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.
--- 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