manifest: use `read_delta_parents` when adjusting linkrev in remotefile
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 01 Aug 2024 13:12:49 +0200
changeset 51782 4704c4c79f21
parent 51781 a891347058e7
child 51783 acc2d0f08fc9
manifest: use `read_delta_parents` when adjusting linkrev in remotefile Let's use the more accurate API.
hgext/remotefilelog/remotefilectx.py
--- a/hgext/remotefilelog/remotefilectx.py	Thu Aug 01 13:10:09 2024 +0200
+++ b/hgext/remotefilelog/remotefilectx.py	Thu Aug 01 13:12:49 2024 +0200
@@ -100,7 +100,11 @@
             if path in data[3]:  # checking the 'files' field.
                 # The file has been touched, check if the hash is what we're
                 # looking for.
-                if fileid == mfl[data[0]].readfast().get(path):
+                #
+                # The change has to be against a parent, otherwise we might be
+                # missing linkrev worthy changes.
+                m = mfl[data[0]].read_delta_parents(exact=False)
+                if fileid == m.get(path):
                     return rev
 
         # Couldn't find the linkrev. This should generally not happen, and will
@@ -199,8 +203,10 @@
         manifestnode, files = ancctx[0], ancctx[3]
         # If the file was touched in this ancestor, and the content is similar
         # to the one we are searching for.
-        if path in files and fnode == mfl[manifestnode].readfast().get(path):
-            return cl.node(ancrev)
+        if path in files:
+            m = mfl[manifestnode].read_delta_parents(exact=False)
+            if fnode == m.get(path):
+                return cl.node(ancrev)
         return None
 
     def _adjustlinknode(self, path, filelog, fnode, srcrev, inclusive=False):