[PATCH 08 of 10 V5] debugconfig: list environment variables in debug output

Jun Wu quark at fb.com
Mon Mar 27 02:02:07 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490589622 25200
#      Sun Mar 26 21:40:22 2017 -0700
# Node ID 0c745bb07fd82bb9383698c60c042101ee45f4ab
# Parent  38572bb2cffd815526a727bc6f3aacdca2902f4f
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 0c745bb07fd8
debugconfig: list environment variables in debug output

Since we print "read config from" for config files, printing environment
variables will make it more consistent.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1808,5 +1808,6 @@ def config(ui, repo, *values, **opts):
             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)
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
 


More information about the Mercurial-devel mailing list