From patchwork Sat Aug 7 14:07:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11267: issue6528: implement _is_revision_affected using callback From: phabricator X-Patchwork-Id: 49581 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Sat, 7 Aug 2021 14:07:39 +0000 marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The delta comming from a bundle/stream does not exists in the revlog yet, so we will need other way to retrieve the same information. To prepare for this we split the function to use callbacks in the core logic. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D11267 AFFECTED FILES mercurial/revlogutils/rewrite.py CHANGE DETAILS To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel 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