D4039: [RFC] shortest: cache disambiguation revset

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Aug 1 21:58:47 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This doesn't seem like the right way to cache it. Suggestions?

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -491,7 +491,9 @@
 
     revset = repo.ui.config('experimental', 'revisions.disambiguatewithin')
     if revset:
-        revs = repo.anyrevs([revset], user=True)
+        if not util.safehasattr(repo, '_cacheddisambiguationrevs'):
+            repo._cacheddisambiguationrevs = repo.anyrevs([revset], user=True)
+        revs = repo._cacheddisambiguationrevs
         if cl.rev(node) in revs:
             hexnode = hex(node)
             for length in range(minlength, len(hexnode) + 1):



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


More information about the Mercurial-devel mailing list