Patchwork [1,of,3] rcutil: do not cache rccomponents

login
register
mail settings
Submitter Jun Wu
Date March 28, 2017, 3:02 p.m.
Message ID <f1c156c854ce36010008.1490713374@localhost.localdomain>
Download mbox | patch
Permalink /patch/19786/
State Accepted
Headers show

Comments

Jun Wu - March 28, 2017, 3:02 p.m.
# HG changeset patch
# User Jun Wu <quark@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.
Yuya Nishihara - March 28, 2017, 3:41 p.m.
On Tue, 28 Mar 2017 08:02:54 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

Looks good. Queued, thanks.

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

Actually, ui.load() may be called every refresh() in hgwebdir, but I don't
think the cost of uncached rccomponents() would outweigh the refresh operation.
Yuya Nishihara - March 29, 2017, noon
On Tue, 28 Mar 2017 08:02:54 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

> diff --git a/a b/a
> new file mode 100644

Found a garbage, dropped and pushed new version.
Jun Wu - March 29, 2017, 2:31 p.m.
Excerpts from Yuya Nishihara's message of 2017-03-29 21:00:09 +0900:
> On Tue, 28 Mar 2017 08:02:54 -0700, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark@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
> 
> > diff --git a/a b/a
> > new file mode 100644
> 
> Found a garbage, dropped and pushed new version.

Ah, sorry for that. Maybe we can check-code files in the root directory.

Patch

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: