##// END OF EJS Templates
tests: extract printrevset extension from test-glog-beautifygraph.t...
Augie Fackler -
r39093:a271466c default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -0,0 +1,41 b''
1 from __future__ import absolute_import
2 from mercurial import (
3 cmdutil,
4 commands,
5 extensions,
6 logcmdutil,
7 revsetlang,
8 smartset,
9 )
10
11 from mercurial.utils import (
12 stringutil,
13 )
14
15 def logrevset(repo, pats, opts):
16 revs = logcmdutil._initialrevs(repo, opts)
17 if not revs:
18 return None
19 match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts)
20 return logcmdutil._makerevset(repo, match, pats, slowpath, opts)
21
22 def uisetup(ui):
23 def printrevset(orig, repo, pats, opts):
24 revs, filematcher = orig(repo, pats, opts)
25 if opts.get(b'print_revset'):
26 expr = logrevset(repo, pats, opts)
27 if expr:
28 tree = revsetlang.parse(expr)
29 tree = revsetlang.analyze(tree)
30 else:
31 tree = []
32 ui = repo.ui
33 ui.write(b'%s\n' % stringutil.pprint(opts.get(b'rev', [])))
34 ui.write(revsetlang.prettyformat(tree) + b'\n')
35 ui.write(stringutil.prettyrepr(revs) + b'\n')
36 revs = smartset.baseset() # display no revisions
37 return revs, filematcher
38 extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
39 aliases, entry = cmdutil.findcmd(b'log', commands.table)
40 entry[1].append((b'', b'print-revset', False,
41 b'print generated revset and exit (DEPRECATED)'))
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now