[PATCH 10 of 13 V3] config: list environment variables in debug output

Martin von Zweigbergk martinvonz at google.com
Thu Mar 23 01:36:13 EDT 2017


On Wed, Mar 22, 2017 at 10:23 AM, Jun Wu <quark at fb.com> wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1489455351 25200
> #      Mon Mar 13 18:35:51 2017 -0700
> # Node ID fa6d527d03e29efc75591e1721ddcbd6b72e4a76
> # Parent  6c04717d3b4958800a39fdf6e2c28e2caf6629bd
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r fa6d527d03e2
> config: list environment variables in debug output
>
> So we can verify the feature in tests.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1803,6 +1803,12 @@ def config(ui, repo, *values, **opts):
>      ui.pager('config')
>      fm = ui.formatter('config', opts)
> -    for f in scmutil.rcpath():
> -        ui.debug('read config from: %s\n' % f)
> +    for (t, f) in scmutil.rccomponents():

nit: we usually don't include the parens around tuples (I think this
applies to an earlier patch too)

> +        if t == 'path':
> +            ui.debug('read config from: %s\n' % f)
> +        elif t == 'items' and f:
> +            for item in f:
> +                source = item[3]
> +                ui.debug('set config by: %s\n' % source)
> +
>      untrusted = bool(opts.get('untrusted'))
>      if values:
> diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t
> --- a/tests/test-hgrc.t
> +++ b/tests/test-hgrc.t
> @@ -177,4 +177,18 @@ plain hgrc
>    --quiet: ui.quiet=False
>
> +with environment variables
> +
> +  $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug
> +  set config by: $EDITOR
> +  set config by: $VISUAL
> +  set config by: $PAGER
> +  read config from: $TESTTMP/hgrc
> +  repo: bundle.mainreporoot=$TESTTMP
> +  $PAGER: pager.pager=p1
> +  $VISUAL: ui.editor=e2
> +  --verbose: ui.verbose=False
> +  --debug: ui.debug=True
> +  --quiet: ui.quiet=False
> +
>  plain mode with exceptions
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list