[Commented On] D11267: issue6528: implement _is_revision_affected using callback

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Sun Aug 8 09:22:40 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 29858.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)
  ⚠ This patch is intended for stable ⚠
  <img src="https://phab.mercurial-scm.org/file/data/bth6ydklc4kd4gmh7a6h/PHID-FILE-uktushir6fpusqhvokji/source.gif" />

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11267?vs=29846&id=29858

BRANCH
  stable

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

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

AFFECTED FILES
  mercurial/revlogutils/rewrite.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/rewrite.py b/mercurial/revlogutils/rewrite.py
--- a/mercurial/revlogutils/rewrite.py
+++ b/mercurial/revlogutils/rewrite.py
@@ -563,6 +563,19 @@
 
 
 def _is_revision_affected(fl, filerev, metadata_cache=None):
+    full_text = lambda: fl._revlog.rawdata(filerev)
+    parent_revs = lambda: fl._revlog.parentrevs(filerev)
+    return _is_revision_affected_inner(
+        full_text, parent_revs, filerev, metadata_cache
+    )
+
+
+def _is_revision_affected_inner(
+    full_text,
+    parents_revs,
+    filerev,
+    metadata_cache=None,
+):
     """Mercurial currently (5.9rc0) uses `p1 == nullrev and p2 != nullrev` as a
     special meaning compared to the reverse in the context of filelog-based
     copytracing. issue6528 exists because new code assumed that parent ordering
@@ -570,7 +583,7 @@
     it's only used for filelog-based copytracing) and its parents are in the
     "wrong" order."""
     try:
-        raw_text = fl.rawdata(filerev)
+        raw_text = full_text()
     except error.CensoredNodeError:
         # We don't care about censored nodes as they never carry metadata
         return False
@@ -578,7 +591,7 @@
     if metadata_cache is not None:
         metadata_cache[filerev] = has_meta
     if has_meta:
-        (p1, p2) = fl.parentrevs(filerev)
+        (p1, p2) = parents_revs()
         if p1 != nullrev and p2 == nullrev:
             return True
     return False



To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210808/60f3603e/attachment-0002.html>


More information about the Mercurial-patches mailing list