diff -r 8407031f195f -r f5c006621f07 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Thu Feb 13 22:51:17 2020 -0500 +++ b/mercurial/cmdutil.py Mon Feb 24 13:50:55 2020 -0500 @@ -2011,7 +2011,12 @@ branch=branch, editor=editor, ) - n = memctx.commit() + + overrides = {} + if opts.get(b'secret'): + overrides[(b'phases', b'new-commit')] = b'secret' + with repo.ui.configoverride(overrides, b'import'): + n = memctx.commit() finally: store.close() if opts.get(b'exact') and nocommit: