Patchwork commit: propagate --secret option to subrepos (issue4182)

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date March 17, 2014, 7:30 p.m.
Message ID <49291d38919293763ce9.1395084647@Iris>
Download mbox | patch
Permalink /patch/3957/
State Superseded
Commit 03774a2b6991b451bde7095238fde9ce98380d28
Headers show

Comments

Jordi Gutiérrez Hermoso - March 17, 2014, 7:30 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1395082633 14400
#      Mon Mar 17 14:57:13 2014 -0400
# Node ID 49291d38919293763ce94d6203b57b904452da13
# Parent  b93791e0de25ac0090d66fa04f956414b572a739
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.
Pierre-Yves David - March 17, 2014, 7:58 p.m.
On 03/17/2014 12:30 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1395082633 14400
> #      Mon Mar 17 14:57:13 2014 -0400
> # Node ID 49291d38919293763ce94d6203b57b904452da13
> # Parent  b93791e0de25ac0090d66fa04f956414b572a739
> commit: propagate --secret option to subrepos (issue4182)

You need to introduce a new test to prevent regression.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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)