##// END OF EJS Templates
errors: name arguments to UnknownCommand constructor...
errors: name arguments to UnknownCommand constructor Differential Revision: https://phab.mercurial-scm.org/D9166

File last commit:

r46139:c1d0f83d default
r46272:bb1a988e default
Show More
printrevset.py
50 lines | 1.4 KiB | text/x-python | PythonLexer
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 from __future__ import absolute_import
Yuya Nishihara
log: introduce struct that carries log traversal options...
r46139 from mercurial.thirdparty import attr
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 from mercurial import (
Augie Fackler
formatting: blacken the codebase...
r43346 cmdutil,
commands,
extensions,
logcmdutil,
revsetlang,
smartset,
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 )
Augie Fackler
formatting: blacken the codebase...
r43346 from mercurial.utils import stringutil
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093
Yuya Nishihara
log: introduce struct that carries log traversal options...
r46139 def logrevset(repo, wopts):
revs = logcmdutil._initialrevs(repo, wopts)
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 if not revs:
return None
Yuya Nishihara
log: introduce struct that carries log traversal options...
r46139 match, pats, slowpath = logcmdutil._makematcher(repo, revs, wopts)
wopts = attr.evolve(wopts, pats=pats)
return logcmdutil._makerevset(repo, wopts, slowpath)
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 def uisetup(ui):
Yuya Nishihara
log: introduce struct that carries log traversal options...
r46139 def printrevset(orig, repo, wopts):
revs, filematcher = orig(repo, wopts)
if wopts.opts.get(b'print_revset'):
expr = logrevset(repo, wopts)
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 if expr:
tree = revsetlang.parse(expr)
tree = revsetlang.analyze(tree)
else:
tree = []
ui = repo.ui
Yuya Nishihara
log: introduce struct that carries log traversal options...
r46139 ui.write(b'%s\n' % stringutil.pprint(wopts.opts.get(b'rev', [])))
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 ui.write(revsetlang.prettyformat(tree) + b'\n')
ui.write(stringutil.prettyrepr(revs) + b'\n')
revs = smartset.baseset() # display no revisions
return revs, filematcher
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: extract printrevset extension from test-glog-beautifygraph.t...
r39093 extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
aliases, entry = cmdutil.findcmd(b'log', commands.table)
Augie Fackler
formatting: blacken the codebase...
r43346 entry[1].append(
(
b'',
b'print-revset',
False,
b'print generated revset and exit (DEPRECATED)',
)
)