On 3/22/17 7:50 AM, Jun Wu wrote:
# HG changeset patch
# User Jun Wu <qu...@fb.com>
# Date 1489455351 25200
#      Mon Mar 13 18:35:51 2017 -0700
# Node ID 23b2b1ed59763e5e676f06a4ac4f6bf567874220
# Parent  add83f47bf3a51edbd58aa0fb6e571d186bdae6e
# Available At 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Jw8rundaE7TbmqBYd1txIQ&m=huA2rodPgFB3VM_ycpq_OLuxGpg_dDjbtlRqYlYdCiU&s=7mjJAE3v-lJCAXwqy4z4aclKYf_Kv3qDeKZFSpMws0g&e=
#              hg pull 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Jw8rundaE7TbmqBYd1txIQ&m=huA2rodPgFB3VM_ycpq_OLuxGpg_dDjbtlRqYlYdCiU&s=7mjJAE3v-lJCAXwqy4z4aclKYf_Kv3qDeKZFSpMws0g&e=
  -r 23b2b1ed5976
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():
+        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

This functionality is awesome. Well done!
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to