Patchwork D7483: changectx: add a "maybe filtered" filtered attribute

login
register
mail settings
Submitter phabricator
Date Nov. 24, 2019, 12:59 a.m.
Message ID <8e9e8d07fd0d91d8c96d53187ab9513c@localhost.localdomain>
Download mbox | patch
Permalink /patch/43498/
State Not Applicable
Headers show

Comments

phabricator - Nov. 24, 2019, 12:59 a.m.
Closed by commit rHG8a37203ab1d5: changectx: add a &quot;maybe filtered&quot; filtered attribute (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7483?vs=18362&id=18369

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -477,10 +477,17 @@ 
     changeset convenient. It represents a read-only context already present in
     the repo."""
 
-    def __init__(self, repo, rev, node):
+    def __init__(self, repo, rev, node, maybe_filtered=True):
         super(changectx, self).__init__(repo)
         self._rev = rev
         self._node = node
+        # When maybe_filtered is True, the revision might be affected by
+        # changelog filtering and operation through the filtered changelog must be used.
+        #
+        # When maybe_filtered is False, the revision has already been checked
+        # against filtering and is not filtered. Operation through the
+        # unfiltered changelog might be used in some case.
+        self._maybe_filtered = maybe_filtered
 
     def __hash__(self):
         try:
@@ -495,7 +502,11 @@ 
 
     @propertycache
     def _changeset(self):
-        return self._repo.changelog.changelogrevision(self.rev())
+        if self._maybe_filtered:
+            repo = self._repo
+        else:
+            repo = self._repo.unfiltered()
+        return repo.changelog.changelogrevision(self.rev())
 
     @propertycache
     def _manifest(self):