[PATCH 1 of 6] debugrevspec: add option to print representation of smartset object
Yuya Nishihara
yuya at tcha.org
Sun Jun 11 05:36:11 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1497092615 -32400
# Sat Jun 10 20:03:35 2017 +0900
# Node ID cd79482b7c41c3e0bc92a4a5c8d3393f6bad7e3d
# Parent 5d233ede383b621a938feb521b43c77bfeb44b83
debugrevspec: add option to print representation of smartset object
It's possible by -v, but -v also prints a parsed tree. Test will be added
later.
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1901,6 +1901,7 @@ def debugrevlog(ui, repo, file_=None, **
@command('debugrevspec',
[('', 'optimize', None,
_('print parsed tree after optimizing (DEPRECATED)')),
+ ('s', 'show-set', None, _('print internal representation of result set')),
('p', 'show-stage', [],
_('print parsed tree at the given stage'), _('NAME')),
('', 'no-optimized', False, _('evaluate tree without optimization')),
@@ -1962,9 +1963,9 @@ def debugrevspec(ui, repo, expr, **opts)
if opts['verify_optimized']:
arevs = revset.makematcher(treebystage['analyzed'])(repo)
brevs = revset.makematcher(treebystage['optimized'])(repo)
- if ui.verbose:
- ui.note(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
- ui.note(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
+ if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
+ ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n")
+ ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n")
arevs = list(arevs)
brevs = list(brevs)
if arevs == brevs:
@@ -1986,8 +1987,8 @@ def debugrevspec(ui, repo, expr, **opts)
func = revset.makematcher(tree)
revs = func(repo)
- if ui.verbose:
- ui.note(("* set:\n"), smartset.prettyformat(revs), "\n")
+ if opts['show_set'] or (opts['show_set'] is None and ui.verbose):
+ ui.write(("* set:\n"), smartset.prettyformat(revs), "\n")
for c in revs:
ui.write("%s\n" % c)
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -281,7 +281,7 @@ Show all commands + options
debugrebuildfncache:
debugrename: rev
debugrevlog: changelog, manifest, dir, dump
- debugrevspec: optimize, show-stage, no-optimized, verify-optimized
+ debugrevspec: optimize, show-set, show-stage, no-optimized, verify-optimized
debugsetparents:
debugsub: rev
debugsuccessorssets:
More information about the Mercurial-devel
mailing list