changectx: use unfiltered changelog to access parents of unfiltered revs
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 17 Nov 2019 08:50:21 +0100
changeset 43764 f9068413bd0c
parent 43763 3fd6ec54704c
child 43765 e89e3275f658
changectx: use unfiltered changelog to access parents of unfiltered revs If a revision is not filtered, we know that its parents are not either. So we can take a shortcut. This shortcut avoid the computation of all filtered revs in some cases. Differential Revision: https://phab.mercurial-scm.org/D7487
mercurial/context.py
tests/test-repo-filters-tiptoe.t
--- a/mercurial/context.py	Sat Nov 23 16:49:34 2019 -0800
+++ b/mercurial/context.py	Sun Nov 17 08:50:21 2019 +0100
@@ -523,7 +523,12 @@
     @propertycache
     def _parents(self):
         repo = self._repo
-        p1, p2 = repo.changelog.parentrevs(self._rev)
+        if self._maybe_filtered:
+            cl = repo.changelog
+        else:
+            cl = repo.unfiltered().changelog
+
+        p1, p2 = cl.parentrevs(self._rev)
         if p2 == nullrev:
             return [repo[p1]]
         return [repo[p1], repo[p2]]
--- a/tests/test-repo-filters-tiptoe.t	Sat Nov 23 16:49:34 2019 -0800
+++ b/tests/test-repo-filters-tiptoe.t	Sun Nov 17 08:50:21 2019 +0100
@@ -58,7 +58,6 @@
 Getting status of null
 
   $ hg status --change null
-  debug.filters: computing revision filter for "visible"
 
 Getting status of working copy