Patchwork [08,of,10,V4] debugconfig: list environment variables in debug output

login
register
mail settings
Submitter Jun Wu
Date March 27, 2017, 4:49 a.m.
Message ID <4ed7dd7a9241b7b792ab.1490590161@localhost.localdomain>
Download mbox | patch
Permalink /patch/19740/
State Superseded
Headers show

Comments

Jun Wu - March 27, 2017, 4:49 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490589622 25200
#      Sun Mar 26 21:40:22 2017 -0700
# Node ID 4ed7dd7a9241b7b792ab6c810d298a70348c9a27
# Parent  bb2927de1dc8c076c6cfe2369effc132e8371beb
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 4ed7dd7a9241
debugconfig: list environment variables in debug output

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

Patch

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