diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1436,11 +1436,14 @@ def commit(ui, repo, *pats, **opts): try: if opts.get('secret'): ui.setconfig('phases', 'new-commit', 'secret') + # Propagate to subrepos + repo.baseui.setconfig('phases', 'new-commit', 'secret') return repo.commit(message, opts.get('user'), opts.get('date'), match, editor=e, extra=extra) finally: ui.setconfig('phases', 'new-commit', oldcommitphase) + repo.baseui.setconfig('phases', 'new-commit', oldcommitphase) node = cmdutil.commit(ui, repo, commitfunc, pats, opts) diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -1294,3 +1294,18 @@ configuration 15: secret $ cd .. + + +Test that comit --secret works on both repo and subrepo (issue4182) + + $ cd main + $ echo secret >> b + $ echo secret >> s/b + $ hg commit --secret --subrepo -m "secret" + committing subrepository s + $ hg phase -r . + 6: secret + $ cd s + $ hg phase -r . + 6: secret + $ cd ../../