D7711: lfs: fix a discrepancy with a function wanting a filelog, but calling it rlog

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Mon Dec 23 02:47:50 EST 2019


mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This conceptually broke in 1541e1a8e87d <https://phab.mercurial-scm.org/rHG1541e1a8e87de9bd6b869ed498ad8e9b93c59d4d> when the filelog isa revlog relationship
  was changed to containment of the revlog.  It was made more obvious in
  62a532045e71 <https://phab.mercurial-scm.org/rHG62a532045e7174e05da4c36484eaaa662bc13ad5> 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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/lfs/wrapper.py

CHANGE DETAILS

diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -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())



To: mharbison72, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list