This is an archive of the discontinued Mercurial Phabricator instance.

debugcommands: introduce debugrevlogindex
ClosedPublic

Authored by indygreg on Aug 22 2018, 4:58 PM.

Details

Summary

hg debugindex was originally invented for displaying revlog index
data and is highly tailored towards that. e.g. it accepts a --format
option to display index data for a particular revlog version and
displays things like offset and length.

As we support non-revlog storage, it makes sense for hg debugindex
to display generic index data and for there to exist storage-specific
or storage-aware debug* commands for dumping non-generic index data.

This commit effectively renames hg debugindex to
hg debugrevlogindex and replaces hg debugindex with a version that
is storage agnostic.

Tests using --format have been updated to use hg debugrevlogindex.

Output is backwards compatible. The replacement command uses the
formatter, which means output can be templatized.

At some point, we may want to tweak output (e.g. to add the revision
size). But I don't feel like taking a bigger BC break at the moment.

The renamed command/function had to be moved because check-code
enforces alphabetical ordering of commands in this file.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Aug 22 2018, 4:58 PM
yuja added a subscriber: yuja.Aug 25 2018, 9:59 PM

Queued the series, thanks.

-@command('debugindex', cmdutil.debugrevlogopts +

  • [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
  • _('[-f FORMAT] -c|-m|FILE'),
  • optionalrepo=True)

-def debugindex(ui, repo, file_=None, **opts):

  • """dump the contents of an index file"""

+@command('debugindex', cmdutil.debugrevlogopts + cmdutil.templateopts,
+ _('-c|-m|FILE'))
+def debugrevlog(ui, repo, file_=None, **opts):

Fixed the function name and the option s/templateopts/formatteropts/.

This revision was automatically updated to reflect the committed changes.