Mercurial > public > mercurial-scm > hg
diff mercurial/debugcommands.py @ 52457:8dede0df9de9
format: add pattern filtering to debugformat
The number of format to consider increase, this will make the command simpler to
use in tests and debug.
See test changes for some direct benefits.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 18 Nov 2024 17:25:30 +0100 |
parents | 9746e618c151 |
children | cac851655570 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Tue Dec 10 10:02:58 2024 +0000 +++ b/mercurial/debugcommands.py Mon Nov 18 17:25:30 2024 +0100 @@ -1625,12 +1625,20 @@ ) -@command(b'debugformat', [] + cmdutil.formatteropts) -def debugformat(ui, repo, **opts): +@command( + b'debugformat', + [] + cmdutil.formatteropts, + b'[PATTERN] ... [PATTERN]', +) +def debugformat(ui, repo, *patterns, **opts): """display format information about the current repository Use --verbose to get extra information about current config value and - Mercurial default.""" + Mercurial default. + + If patterns are specified, only format matching at least one of these + pattern will be displayed. + """ maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) maxvariantlength = max(len(b'format-variant'), maxvariantlength) @@ -1658,6 +1666,14 @@ fm.plain(b' config default') fm.plain(b'\n') for fv in upgrade.allformatvariant: + if patterns: + for p in patterns: + # XXX support "re:" at some point + if p in fv.name: + break + else: + # no pattern matches, continue + continue fm.startitem() repovalue = fv.fromrepo(repo) configvalue = fv.fromconfig(repo)