D4202: fastannotate: move some global state mutation to extsetup()
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Thu Aug 9 19:13:40 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4202
AFFECTED FILES
hgext/fastannotate/__init__.py
hgext/fastannotate/protocol.py
CHANGE DETAILS
diff --git a/hgext/fastannotate/protocol.py b/hgext/fastannotate/protocol.py
--- a/hgext/fastannotate/protocol.py
+++ b/hgext/fastannotate/protocol.py
@@ -223,5 +223,7 @@
_registerwireprotocommand()
if isinstance(repo, localrepo.localrepository):
localreposetup(ui, repo)
+ # TODO: this mutates global state, but only if at least one repo
+ # has the extension enabled. This is probably bad for hgweb.
if peersetup not in hg.wirepeersetupfuncs:
hg.wirepeersetupfuncs.append(peersetup)
diff --git a/hgext/fastannotate/__init__.py b/hgext/fastannotate/__init__.py
--- a/hgext/fastannotate/__init__.py
+++ b/hgext/fastannotate/__init__.py
@@ -100,8 +100,6 @@
#
# * rename the config knob for updating the local cache from a remote server
#
-# * move various global-setup bits to extsetup() or reposetup()
-#
# * move `flock` based locking to a common area
#
# * revise wireprotocol for sharing annotate files
@@ -185,7 +183,9 @@
if ui.configbool('fastannotate', 'useflock', _flockavailable()):
context.pathhelper.lock = context.pathhelper._lockflock
+def extsetup(ui):
# fastannotate has its own locking, without depending on repo lock
+ # TODO: avoid mutating this unless the specific repo has it enabled
localrepo.localrepository._wlockfreeprefix.add('fastannotate/')
def reposetup(ui, repo):
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list