# HG changeset patch # User Matt Harbison # Date 2024-08-21 21:41:57 # Node ID c371134fef01d2a04f4ee639679b8d2b0d4dc728 # Parent 71fb6e0a7a35373ce136dbe13a677c6d545edec5 remotefilelog: adapt the `debugindex` command to past API changes Pytype was missing these problems because it's currently inferring the classes for `filelog` and `revlog` to be `Any`. When that's fixed, these were flagged, so fix these first. The `filelog` class used to subclass `revlog`, but that was changed back in 1541e1a8e87d (with most or all of the "lost" attributes being forwarded to the embedded `revlog` attribute at that time). These forwarded references were dropped over time, and this command has been broken at least as far back as 68282a7b29a7 when the `version` field was dropped. Most of the fixes were as simple as calling the accessor for the embedded `revlog` member, but the general delta feature detection was a bit more involved- I copied the detection for it from `mercurial.revlogutils.debug.debug_revlog()`. diff --git a/hgext/remotefilelog/debugcommands.py b/hgext/remotefilelog/debugcommands.py --- a/hgext/remotefilelog/debugcommands.py +++ b/hgext/remotefilelog/debugcommands.py @@ -119,7 +119,7 @@ def debugindex(orig, ui, repo, file_=Non if format not in (0, 1): raise error.Abort(_(b"unknown format %d") % format) - generaldelta = r.version & revlog.FLAG_GENERALDELTA + generaldelta = r.get_revlog()._format_flags & revlog.FLAG_GENERALDELTA if generaldelta: basehdr = b' delta' else: @@ -144,9 +144,9 @@ def debugindex(orig, ui, repo, file_=Non for i in r: node = r.node(i) if generaldelta: - base = r.deltaparent(i) + base = r.get_revlog().deltaparent(i) else: - base = r.chainbase(i) + base = r.get_revlog().chainbase(i) if format == 0: try: pp = r.parents(node) @@ -156,8 +156,8 @@ def debugindex(orig, ui, repo, file_=Non b"% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( i, - r.start(i), - r.length(i), + r.get_revlog().start(i), + r.get_revlog().length(i), base, r.linkrev(i), short(node), @@ -171,10 +171,10 @@ def debugindex(orig, ui, repo, file_=Non b"% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( i, - r.flags(i), - r.start(i), - r.length(i), - r.rawsize(i), + r.get_revlog().flags(i), + r.get_revlog().start(i), + r.get_revlog().length(i), + r.get_revlog().rawsize(i), base, r.linkrev(i), pr[0],