##// END OF EJS Templates
revlog: subclass the new `repository.iverifyproblem` Protocol class...
revlog: subclass the new `repository.iverifyproblem` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. We shouldn't have to explicitly subclass, but I'm doing so to test the interplay of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature that puts a jump point in the gutter to navigate back and forth between the base class and subclasses (and override functions and base class functions) when there's an explicit subclassing. Additionally, PyCharm will immediately flag signature mismatches without a 40m pytype run.

File last commit:

r49730:6000f5b2 default
r53365:4ef6dbc2 default
Show More
printrevset.py
49 lines | 1.4 KiB | text/x-python | PythonLexer
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)',
)
)