Patchwork D6541: remotefilelog: check if RFL is enabled in getrenamedfn() override

login
register
mail settings
Submitter phabricator
Date June 19, 2019, 6:31 p.m.
Message ID <differential-rev-PHID-DREV-ae6jfxcak3dizvuzv2te-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40598/
State Superseded
Headers show

Comments

phabricator - June 19, 2019, 6:31 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In 8a0e03f7baf4 <https://phab.mercurial-scm.org/rHG8a0e03f7baf4e2639519ef787324b591bd5d9d82> (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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6541

AFFECTED FILES
  hgext/remotefilelog/__init__.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py
+++ b/hgext/remotefilelog/__init__.py
@@ -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):