Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 32815:f78d210f599d
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 10 Jun 2017 20:03:35 +0900 |
parents | 23734c0e361f |
children | bcca357bb792 |
comparison
equal
deleted
inserted
replaced
32814:6f775d10e83b | 32815:f78d210f599d |
---|---|
1899 numdeltas)) | 1899 numdeltas)) |
1900 | 1900 |
1901 @command('debugrevspec', | 1901 @command('debugrevspec', |
1902 [('', 'optimize', None, | 1902 [('', 'optimize', None, |
1903 _('print parsed tree after optimizing (DEPRECATED)')), | 1903 _('print parsed tree after optimizing (DEPRECATED)')), |
1904 ('s', 'show-set', None, _('print internal representation of result set')), | |
1904 ('p', 'show-stage', [], | 1905 ('p', 'show-stage', [], |
1905 _('print parsed tree at the given stage'), _('NAME')), | 1906 _('print parsed tree at the given stage'), _('NAME')), |
1906 ('', 'no-optimized', False, _('evaluate tree without optimization')), | 1907 ('', 'no-optimized', False, _('evaluate tree without optimization')), |
1907 ('', 'verify-optimized', False, _('verify optimized result')), | 1908 ('', 'verify-optimized', False, _('verify optimized result')), |
1908 ], | 1909 ], |
1960 printedtree = tree | 1961 printedtree = tree |
1961 | 1962 |
1962 if opts['verify_optimized']: | 1963 if opts['verify_optimized']: |
1963 arevs = revset.makematcher(treebystage['analyzed'])(repo) | 1964 arevs = revset.makematcher(treebystage['analyzed'])(repo) |
1964 brevs = revset.makematcher(treebystage['optimized'])(repo) | 1965 brevs = revset.makematcher(treebystage['optimized'])(repo) |
1965 if ui.verbose: | 1966 if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
1966 ui.note(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n") | 1967 ui.write(("* analyzed set:\n"), smartset.prettyformat(arevs), "\n") |
1967 ui.note(("* optimized set:\n"), smartset.prettyformat(brevs), "\n") | 1968 ui.write(("* optimized set:\n"), smartset.prettyformat(brevs), "\n") |
1968 arevs = list(arevs) | 1969 arevs = list(arevs) |
1969 brevs = list(brevs) | 1970 brevs = list(brevs) |
1970 if arevs == brevs: | 1971 if arevs == brevs: |
1971 return 0 | 1972 return 0 |
1972 ui.write(('--- analyzed\n'), label='diff.file_a') | 1973 ui.write(('--- analyzed\n'), label='diff.file_a') |
1984 ui.write(' %s\n' % c) | 1985 ui.write(' %s\n' % c) |
1985 return 1 | 1986 return 1 |
1986 | 1987 |
1987 func = revset.makematcher(tree) | 1988 func = revset.makematcher(tree) |
1988 revs = func(repo) | 1989 revs = func(repo) |
1989 if ui.verbose: | 1990 if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
1990 ui.note(("* set:\n"), smartset.prettyformat(revs), "\n") | 1991 ui.write(("* set:\n"), smartset.prettyformat(revs), "\n") |
1991 for c in revs: | 1992 for c in revs: |
1992 ui.write("%s\n" % c) | 1993 ui.write("%s\n" % c) |
1993 | 1994 |
1994 @command('debugsetparents', [], _('REV1 [REV2]')) | 1995 @command('debugsetparents', [], _('REV1 [REV2]')) |
1995 def debugsetparents(ui, repo, rev1, rev2=None): | 1996 def debugsetparents(ui, repo, rev1, rev2=None): |