Patchwork D7487: changectx: use unfiltered changelog to access parents of unfiltered revs

login
register
mail settings
Submitter phabricator
Date Nov. 22, 2019, 9:22 a.m.
Message ID <differential-rev-PHID-DREV-s3hf5brcfgxqewfazudv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43423/
State Superseded
Headers show

Comments

phabricator - Nov. 22, 2019, 9:22 a.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -60,4 +60,3 @@ 
 Getting status of null
 
   $ hg status --change null
-  debug.filters: computing revision filter for "visible"
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -517,7 +517,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]]