remotefilelog: check if RFL is enabled in getrenamedfn() override
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 19 Jun 2019 11:12:06 -0700
changeset 42499 f93762f251d2
parent 42498 089f14dd7df3
child 42500 e387cb22f6c0
remotefilelog: check if RFL is enabled in getrenamedfn() override In 8a0e03f7baf4 (remotefilelog: move most setup from onetimesetup() to uisetup(), 2019-05-01), I said: All the wrappers moved in this patch check if remotefilelog is enabled before they change behavior, so it's safe to always wrap. That was clearly a lie, because getrenamedfn() didn't. That made e.g. `hg log -T {file_copies}` unbearably slow. This patch fixes that. Differential Revision: https://phab.mercurial-scm.org/D6541
hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py	Tue Jun 18 08:55:23 2019 -0700
+++ b/hgext/remotefilelog/__init__.py	Wed Jun 19 11:12:06 2019 -0700
@@ -316,7 +316,7 @@
     scmutil.fileprefetchhooks.add('remotefilelog', _fileprefetchhook)
 
     # disappointing hacks below
-    scmutil.getrenamedfn = getrenamedfn
+    extensions.wrapfunction(scmutil, 'getrenamedfn', getrenamedfn)
     extensions.wrapfunction(revset, 'filelog', filelogrevset)
     revset.symbols['filelog'] = revset.filelog
     extensions.wrapfunction(cmdutil, 'walkfilerevs', walkfilerevs)
@@ -635,7 +635,10 @@
         return node
     extensions.wrapfunction(changelog.changelog, 'add', changelogadd)
 
-def getrenamedfn(repo, endrev=None):
+def getrenamedfn(orig, repo, endrev=None):
+    if not isenabled(repo):
+        return orig(repo, endrev)
+
     rcache = {}
 
     def getrenamed(fn, rev):