[PATCH 1 of 3] rcutil: do not cache rccomponents

Jun Wu quark at fb.com
Tue Mar 28 15:02:54 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490712840 25200
#      Tue Mar 28 07:54:00 2017 -0700
# Node ID f1c156c854ce36010008816ed6c5097a809ba5e5
# Parent  c3ca0ad8ab9c60b3d4df4ef1e5e2e7d9e44cec0e
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r f1c156c854ce
rcutil: do not cache rccomponents

The function is only called once except for "hg debugconfig", where it is
called twice. So there is no need to cache it.

Caching it will cause issues with chgserver. Instead of dropping the cache
in chagserver, it seems cleaner to just avoid the cache.

diff --git a/a b/a
new file mode 100644
diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py
--- a/mercurial/rcutil.py
+++ b/mercurial/rcutil.py
@@ -63,6 +63,4 @@ def defaultrcpath():
     return path
 
-_rccomponents = None
-
 def rccomponents():
     '''return an ordered [(type, obj)] about where to load configs.
@@ -79,5 +77,5 @@ def rccomponents():
     envrc = ('items', envrcitems())
 
-    global _rccomponents
+    _rccomponents = None
     if _rccomponents is None:
         if 'HGRCPATH' in encoding.environ:


More information about the Mercurial-devel mailing list