Mercurial > hg
changeset 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 | 672e0558aed1 |
children | 9a74b9919581 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
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'):