# HG changeset patch # User Matt Harbison # Date 2020-02-16 22:05:18 # Node ID b339faf3f843328fbc8be13d56c57ad8e1e79172 # Parent d1177d39012e585e42a72edebd5af7f5a614a27c import: don't ignore `--secret` when `--bypass` is specified Differential Revision: https://phab.mercurial-scm.org/D8126 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1898,7 +1898,12 @@ def tryimportone(ui, repo, patchdata, pa 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: diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -478,6 +478,12 @@ hg import --secret +line 2 $ hg --cwd b phase 1: secret + $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet + $ hg --cwd b import --bypass --secret ../exported-tip.patch + applying ../exported-tip.patch + $ hg --cwd b phase -r tip + 1: secret + $ hg --cwd b --config extensions.strip= strip 1 --no-backup --quiet $ rm -r b