diff mercurial/cmdutil.py @ 25020:747055706e85

import: use ui.allowemptycommit to allow empty commits Previously import used force=partial to allow empty commits to be made. Let's switch it to using the new ui.allowemptycommit option. Tests says we can drop the 'force' argument in the processs.
author Durham Goode <durham@fb.com>
date Mon, 11 May 2015 20:15:41 -0700
parents 0579b0c2ea2b
children d6e7ac651973
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon May 11 17:51:22 2015 -0700
+++ b/mercurial/cmdutil.py	Mon May 11 20:15:41 2015 -0700
@@ -897,9 +897,15 @@
                     editor = None
                 else:
                     editor = getcommiteditor(editform=editform, **opts)
-                n = repo.commit(message, opts.get('user') or user,
-                                opts.get('date') or date, match=m,
-                                editor=editor, force=partial)
+                allowemptyback = repo.ui.backupconfig('ui', 'allowemptycommit')
+                try:
+                    if partial:
+                        repo.ui.setconfig('ui', 'allowemptycommit', True)
+                    n = repo.commit(message, opts.get('user') or user,
+                                    opts.get('date') or date, match=m,
+                                    editor=editor)
+                finally:
+                    repo.ui.restoreconfig(allowemptyback)
             dsguard.close()
         else:
             if opts.get('exact') or opts.get('import_branch'):