# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1395082633 14400 # Node ID 03774a2b6991b451bde7095238fde9ce98380d28 # Parent 434619dae569c40e6a8345616c5be180b1b87311 commit: propagate --secret option to subrepos (issue4182) Before this patch, `hg commit --secret` was not getting propagated correctly, and subrepos were not getting the commit in the secret phase. The problem is that subrepos get their ui from the base repo's baseui object and ignore the ui object passed on to them. This sets and restores both ui objects with the appropriate option. diff -r 434619dae569 -r 03774a2b6991 mercurial/commands.py --- a/mercurial/commands.py Wed Mar 19 01:07:41 2014 +0900 +++ b/mercurial/commands.py Mon Mar 17 14:57:13 2014 -0400 @@ -1436,11 +1436,14 @@ 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 -r 434619dae569 -r 03774a2b6991 tests/test-subrepo.t --- a/tests/test-subrepo.t Wed Mar 19 01:07:41 2014 +0900 +++ b/tests/test-subrepo.t Mon Mar 17 14:57:13 2014 -0400 @@ -1294,3 +1294,18 @@ 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 ../../