lfs: fix a discrepancy with a function wanting a filelog, but calling it rlog
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 22 Dec 2019 23:09:37 -0500
changeset 43963 26cf356ae772
parent 43962 7c3118b9a9db
child 43964 f384d68d8ea8
lfs: fix a discrepancy with a function wanting a filelog, but calling it rlog This conceptually broke in 1541e1a8e87d when the filelog isa revlog relationship was changed to containment of the revlog. It was made more obvious in 62a532045e71 and related API simplification. It's resolved in favor of passing a revlog because the revlog verification code doesn't have a reference to a filelog. Differential Revision: https://phab.mercurial-scm.org/D7711
hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py	Sun Dec 22 16:36:09 2019 -0500
+++ b/hgext/lfs/wrapper.py	Sun Dec 22 23:09:37 2019 -0500
@@ -151,12 +151,12 @@
         if node is None:
             # both None - likely working copy content where node is not ready
             return False
-        rev = rlog._revlog.rev(node)
+        rev = rlog.rev(node)
     else:
-        node = rlog._revlog.node(rev)
+        node = rlog.node(rev)
     if node == nullid:
         return False
-    flags = rlog._revlog.flags(rev)
+    flags = rlog.flags(rev)
     return bool(flags & revlog.REVIDX_EXTSTORED)
 
 
@@ -203,7 +203,7 @@
 
 # Wrapping may also be applied by remotefilelog
 def filelogrenamed(orig, self, node):
-    if _islfs(self, node):
+    if _islfs(self._revlog, node):
         rawtext = self._revlog.rawdata(node)
         if not rawtext:
             return False
@@ -217,7 +217,7 @@
 
 # Wrapping may also be applied by remotefilelog
 def filelogsize(orig, self, rev):
-    if _islfs(self, rev=rev):
+    if _islfs(self._revlog, rev=rev):
         # fast path: use lfs metadata to answer size
         rawtext = self._revlog.rawdata(rev)
         metadata = pointer.deserialize(rawtext)
@@ -248,7 +248,7 @@
 
 
 def filectxislfs(self):
-    return _islfs(self.filelog(), self.filenode())
+    return _islfs(self.filelog()._revlog, self.filenode())
 
 
 @eh.wrapfunction(cmdutil, b'_updatecatformatter')
@@ -459,7 +459,7 @@
         else:
             return None
     fctx = _ctx[f]
-    if not _islfs(fctx.filelog(), fctx.filenode()):
+    if not _islfs(fctx.filelog()._revlog, fctx.filenode()):
         return None
     try:
         p = pointer.deserialize(fctx.rawdata())