diff -r f96988680afe -r 1040d54eb7eb hgext/uncommit.py --- a/hgext/uncommit.py Thu Feb 14 15:17:54 2019 -0800 +++ b/hgext/uncommit.py Fri Feb 15 10:39:45 2019 -0800 @@ -44,6 +44,9 @@ configitem('experimental', 'uncommitondirtywdir', default=False, ) +configitem('experimental', 'uncommit.keep', + default=False, +) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should @@ -136,7 +139,7 @@ ds.copy(src, dst) @command('uncommit', - [('', 'keep', False, _('allow an empty commit after uncommiting')), + [('', 'keep', None, _('allow an empty commit after uncommiting')), ] + commands.walkopts, _('[OPTION]... [FILE]...'), helpcategory=command.CATEGORY_CHANGE_MANAGEMENT) @@ -165,7 +168,12 @@ with repo.transaction('uncommit'): match = scmutil.match(old, pats, opts) - keepcommit = opts.get('keep') or pats + keepcommit = pats + if not keepcommit: + if opts.get('keep') is not None: + keepcommit = opts.get('keep') + else: + keepcommit = ui.configbool('experimental', 'uncommit.keep') newid = _commitfiltered(repo, old, match, keepcommit) if newid is None: ui.status(_("nothing to uncommit\n"))