[PATCH] hg: provide a way to skip reposetup
Jun Wu
quark at fb.com
Tue Feb 16 14:49:12 UTC 2016
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1455633827 0
# Tue Feb 16 14:43:47 2016 +0000
# Node ID a11475e5c22992be3248e53fed9153c1c68c6244
# Parent 923500ca4f9a294db25318db07239359ad131348
hg: provide a way to skip reposetup
During chgserver startup, it will load repo config to decide which extensions
should be preloaded (and call {ext,ui}setup). But it does not actually use the
repo, thus calling reposetup is unnecessary. We choose not to preload repo
because we try to minimize the number of chgserver processes. A chgserver can
be shared among repos with a same sensitive ([extensions] etc.) configs.
Some extensions have unwanted side effects in reposetup. We can fix all the
extensions we saw but there may be others outside our sight. This patch adds
a boolean flag to control whether reposetup should be called or not to address
the issue.
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -142,14 +142,19 @@
# a list of (ui, repo) functions called for wire peer initialization
wirepeersetupfuncs = []
+# whether to skip reposetup. this is primarily used by chgserver to get
+# rid of unwanted side effects caused by some extensions.
+skipreposetup = False
+
def _peerorrepo(ui, path, create=False):
"""return a repository object for the specified path"""
obj = _peerlookup(path).instance(ui, path, create)
ui = getattr(obj, "ui", ui)
- for name, module in extensions.extensions(ui):
- hook = getattr(module, 'reposetup', None)
- if hook:
- hook(ui, obj)
+ if not skipreposetup:
+ for name, module in extensions.extensions(ui):
+ hook = getattr(module, 'reposetup', None)
+ if hook:
+ hook(ui, obj)
if not obj.local():
for f in wirepeersetupfuncs:
f(ui, obj)
More information about the Mercurial-devel
mailing list