changeset 31686:fbc4eb8e2433

debugconfig: list environment variables in debug output Since we print "read config from" for config files, printing environment variables will make it more consistent.
author Jun Wu <quark@fb.com>
date Sun, 26 Mar 2017 21:40:22 -0700
parents d83e51654c8a
children 5bea95a1d353
files mercurial/commands.py tests/test-hgrc.t
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Mar 26 21:33:37 2017 -0700
+++ b/mercurial/commands.py	Sun Mar 26 21:40:22 2017 -0700
@@ -1808,7 +1808,8 @@
         if t == 'path':
             ui.debug('read config from: %s\n' % f)
         elif t == 'items':
-            pass
+            for section, name, value, source in f:
+                ui.debug('set config by: %s\n' % source)
         else:
             raise error.ProgrammingError('unknown rctype: %s' % t)
     untrusted = bool(opts.get('untrusted'))
--- a/tests/test-hgrc.t	Sun Mar 26 21:33:37 2017 -0700
+++ b/tests/test-hgrc.t	Sun Mar 26 21:40:22 2017 -0700
@@ -176,6 +176,20 @@
   --debug: ui.debug=True
   --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
 
   $ cat > plain.py <<EOF