1 from __future__ import absolute_import |
1 from __future__ import absolute_import |
2 from mercurial import ( |
2 from mercurial import ( |
3 cmdutil, |
3 cmdutil, |
4 commands, |
4 commands, |
5 extensions, |
5 extensions, |
6 logcmdutil, |
6 logcmdutil, |
7 revsetlang, |
7 revsetlang, |
8 smartset, |
8 smartset, |
9 ) |
9 ) |
10 |
10 |
11 from mercurial.utils import ( |
11 from mercurial.utils import stringutil |
12 stringutil, |
12 |
13 ) |
|
14 |
13 |
15 def logrevset(repo, pats, opts): |
14 def logrevset(repo, pats, opts): |
16 revs = logcmdutil._initialrevs(repo, opts) |
15 revs = logcmdutil._initialrevs(repo, opts) |
17 if not revs: |
16 if not revs: |
18 return None |
17 return None |
19 match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts) |
18 match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts) |
20 return logcmdutil._makerevset(repo, match, pats, slowpath, opts) |
19 return logcmdutil._makerevset(repo, match, pats, slowpath, opts) |
|
20 |
21 |
21 |
22 def uisetup(ui): |
22 def uisetup(ui): |
23 def printrevset(orig, repo, pats, opts): |
23 def printrevset(orig, repo, pats, opts): |
24 revs, filematcher = orig(repo, pats, opts) |
24 revs, filematcher = orig(repo, pats, opts) |
25 if opts.get(b'print_revset'): |
25 if opts.get(b'print_revset'): |
33 ui.write(b'%s\n' % stringutil.pprint(opts.get(b'rev', []))) |
33 ui.write(b'%s\n' % stringutil.pprint(opts.get(b'rev', []))) |
34 ui.write(revsetlang.prettyformat(tree) + b'\n') |
34 ui.write(revsetlang.prettyformat(tree) + b'\n') |
35 ui.write(stringutil.prettyrepr(revs) + b'\n') |
35 ui.write(stringutil.prettyrepr(revs) + b'\n') |
36 revs = smartset.baseset() # display no revisions |
36 revs = smartset.baseset() # display no revisions |
37 return revs, filematcher |
37 return revs, filematcher |
|
38 |
38 extensions.wrapfunction(logcmdutil, 'getrevs', printrevset) |
39 extensions.wrapfunction(logcmdutil, 'getrevs', printrevset) |
39 aliases, entry = cmdutil.findcmd(b'log', commands.table) |
40 aliases, entry = cmdutil.findcmd(b'log', commands.table) |
40 entry[1].append((b'', b'print-revset', False, |
41 entry[1].append( |
41 b'print generated revset and exit (DEPRECATED)')) |
42 ( |
|
43 b'', |
|
44 b'print-revset', |
|
45 False, |
|
46 b'print generated revset and exit (DEPRECATED)', |
|
47 ) |
|
48 ) |