##// END OF EJS Templates
cmdutil: drop aliases for logcmdutil functions (API)...
Yuya Nishihara -
r35906:c8e2d6ed default
parent child Browse files
Show More
@@ -300,8 +300,8 b' import time'
300 300 from mercurial.i18n import _
301 301 from mercurial.node import short
302 302 from mercurial import (
303 cmdutil,
304 303 error,
304 logcmdutil,
305 305 mail,
306 306 registrar,
307 307 url,
@@ -1090,9 +1090,9 b' class bugzilla(object):'
1090 1090 if not mapfile and not tmpl:
1091 1091 tmpl = _('changeset {node|short} in repo {root} refers '
1092 1092 'to bug {bug}.\ndetails:\n\t{desc|tabindent}')
1093 spec = cmdutil.logtemplatespec(tmpl, mapfile)
1094 t = cmdutil.changeset_templater(self.ui, self.repo, spec,
1095 False, None, False)
1093 spec = logcmdutil.templatespec(tmpl, mapfile)
1094 t = logcmdutil.changesettemplater(self.ui, self.repo, spec,
1095 False, None, False)
1096 1096 self.ui.pushbuffer()
1097 1097 t.show(ctx, changes=ctx.changeset(),
1098 1098 bug=str(bugid),
@@ -19,6 +19,7 b' from __future__ import absolute_import'
19 19 from mercurial.i18n import _
20 20 from mercurial import (
21 21 cmdutil,
22 logcmdutil,
22 23 pycompat,
23 24 registrar,
24 25 )
@@ -65,7 +66,7 b' def children(ui, repo, file_=None, **opt'
65 66 ctx = repo[rev]
66 67 childctxs = ctx.children()
67 68
68 displayer = cmdutil.show_changeset(ui, repo, opts)
69 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
69 70 for cctx in childctxs:
70 71 displayer.show(cctx)
71 72 displayer.close()
@@ -18,6 +18,7 b' from mercurial.i18n import _'
18 18 from mercurial import (
19 19 cmdutil,
20 20 encoding,
21 logcmdutil,
21 22 patch,
22 23 pycompat,
23 24 registrar,
@@ -54,7 +55,7 b' def countrate(ui, repo, amap, *pats, **o'
54 55 return date.strftime(opts['dateformat'])
55 56 else:
56 57 tmpl = opts.get('oldtemplate') or opts.get('template')
57 tmpl = cmdutil.makelogtemplater(ui, repo, tmpl)
58 tmpl = logcmdutil.maketemplater(ui, repo, tmpl)
58 59 def getkey(ctx):
59 60 ui.pushbuffer()
60 61 tmpl.show(ctx)
@@ -29,6 +29,7 b' from mercurial import ('
29 29 hg,
30 30 localrepo,
31 31 lock,
32 logcmdutil,
32 33 node,
33 34 pycompat,
34 35 registrar,
@@ -478,7 +479,7 b' def journal(ui, repo, *args, **opts):'
478 479 displayname = "'%s'" % name
479 480 ui.status(_("previous locations of %s:\n") % displayname)
480 481
481 limit = cmdutil.loglimit(opts)
482 limit = logcmdutil.getlimit(opts)
482 483 entry = None
483 484 ui.pager('journal')
484 485 for count, entry in enumerate(repo.journal.filtered(name=name)):
@@ -502,7 +503,8 b' def journal(ui, repo, *args, **opts):'
502 503 fm.write('command', ' %s\n', entry.command)
503 504
504 505 if opts.get("commits"):
505 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False)
506 displayer = logcmdutil.changesetdisplayer(ui, repo, opts,
507 buffered=False)
506 508 for hash in entry.newhashes:
507 509 try:
508 510 ctx = repo[hash]
@@ -101,6 +101,7 b' from mercurial import ('
101 101 extensions,
102 102 filelog,
103 103 localrepo,
104 logcmdutil,
104 105 match,
105 106 patch,
106 107 pathutil,
@@ -254,7 +255,7 b' class kwtemplater(object):'
254 255 '''Replaces keywords in data with expanded template.'''
255 256 def kwsub(mobj):
256 257 kw = mobj.group(1)
257 ct = cmdutil.makelogtemplater(self.ui, self.repo,
258 ct = logcmdutil.maketemplater(self.ui, self.repo,
258 259 self.templates[kw])
259 260 self.ui.pushbuffer()
260 261 ct.show(ctx, root=self.repo.root, file=path)
@@ -86,6 +86,7 b' from mercurial import ('
86 86 hg,
87 87 localrepo,
88 88 lock as lockmod,
89 logcmdutil,
89 90 patch as patchmod,
90 91 phases,
91 92 pycompat,
@@ -743,8 +744,8 b' class queue(object):'
743 744 opts = {}
744 745 stat = opts.get('stat')
745 746 m = scmutil.match(repo[node1], files, opts)
746 cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m,
747 changes, stat, fp)
747 logcmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m,
748 changes, stat, fp)
748 749
749 750 def mergeone(self, repo, mergeq, head, patch, rev, diffopts):
750 751 # first try just applying the patch
@@ -142,8 +142,8 b' import time'
142 142
143 143 from mercurial.i18n import _
144 144 from mercurial import (
145 cmdutil,
146 145 error,
146 logcmdutil,
147 147 mail,
148 148 patch,
149 149 registrar,
@@ -257,9 +257,9 b' class notifier(object):'
257 257 mapfile = self.ui.config('notify', 'style')
258 258 if not mapfile and not template:
259 259 template = deftemplates.get(hooktype) or single_template
260 spec = cmdutil.logtemplatespec(template, mapfile)
261 self.t = cmdutil.changeset_templater(self.ui, self.repo, spec,
262 False, None, False)
260 spec = logcmdutil.templatespec(template, mapfile)
261 self.t = logcmdutil.changesettemplater(self.ui, self.repo, spec,
262 False, None, False)
263 263
264 264 def strip(self, path):
265 265 '''strip leading slashes from local path, turn into web-safe path.'''
@@ -39,6 +39,7 b' from mercurial import ('
39 39 error,
40 40 formatter,
41 41 graphmod,
42 logcmdutil,
42 43 phases,
43 44 pycompat,
44 45 registrar,
@@ -148,7 +149,7 b' def show(ui, repo, view=None, template=N'
148 149 elif fn._csettopic:
149 150 ref = 'show%s' % fn._csettopic
150 151 spec = formatter.lookuptemplate(ui, ref, template)
151 displayer = cmdutil.changeset_templater(ui, repo, spec, buffered=True)
152 displayer = logcmdutil.changesettemplater(ui, repo, spec, buffered=True)
152 153 return fn(ui, repo, displayer)
153 154 else:
154 155 return fn(ui, repo)
@@ -409,8 +410,8 b' def showwork(ui, repo, displayer):'
409 410 revdag = graphmod.dagwalker(repo, revs)
410 411
411 412 ui.setconfig('experimental', 'graphshorten', True)
412 cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges,
413 props={'nodelen': nodelen})
413 logcmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges,
414 props={'nodelen': nodelen})
414 415
415 416 def extsetup(ui):
416 417 # Alias `hg <prefix><view>` to `hg show <view>`.
@@ -24,6 +24,7 b' from mercurial import ('
24 24 error,
25 25 exchange,
26 26 hg,
27 logcmdutil,
27 28 match,
28 29 merge,
29 30 node as nodemod,
@@ -501,7 +502,7 b' def hasnode(repo, node):'
501 502
502 503 def browserevs(ui, repo, nodes, opts):
503 504 '''interactively transplant changesets'''
504 displayer = cmdutil.show_changeset(ui, repo, opts)
505 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
505 506 transplants = []
506 507 merges = []
507 508 prompt = _('apply changeset? [ynmpcq?]:'
@@ -46,22 +46,6 b' from . import ('
46 46 )
47 47 stringio = util.stringio
48 48
49 loglimit = logcmdutil.getlimit
50 diffordiffstat = logcmdutil.diffordiffstat
51 _changesetlabels = logcmdutil.changesetlabels
52 changeset_printer = logcmdutil.changesetprinter
53 jsonchangeset = logcmdutil.jsonchangeset
54 changeset_templater = logcmdutil.changesettemplater
55 logtemplatespec = logcmdutil.templatespec
56 makelogtemplater = logcmdutil.maketemplater
57 show_changeset = logcmdutil.changesetdisplayer
58 getlogrevs = logcmdutil.getrevs
59 getloglinerangerevs = logcmdutil.getlinerangerevs
60 displaygraph = logcmdutil.displaygraph
61 graphlog = logcmdutil.graphlog
62 checkunsupportedgraphflags = logcmdutil.checkunsupportedgraphflags
63 graphrevs = logcmdutil.graphrevs
64
65 49 # templates of common command options
66 50
67 51 dryrunopts = [
@@ -2526,7 +2510,7 b' def commitforceeditor(repo, ctx, subs, f'
2526 2510 def buildcommittemplate(repo, ctx, subs, extramsg, ref):
2527 2511 ui = repo.ui
2528 2512 spec = formatter.templatespec(ref, None, None)
2529 t = changeset_templater(ui, repo, spec, None, {}, False)
2513 t = logcmdutil.changesettemplater(ui, repo, spec, None, {}, False)
2530 2514 t.t.cache.update((k, templater.unquotestring(v))
2531 2515 for k, v in repo.ui.configitems('committemplate'))
2532 2516
@@ -41,6 +41,7 b' from . import ('
41 41 help,
42 42 hg,
43 43 lock as lockmod,
44 logcmdutil,
44 45 merge as mergemod,
45 46 obsolete,
46 47 obsutil,
@@ -823,7 +824,7 b' def bisect(ui, repo, rev=None, extra=Non'
823 824 cmdutil.bailifchanged(repo)
824 825 return hg.clean(repo, node, show_stats=show_stats)
825 826
826 displayer = cmdutil.show_changeset(ui, repo, {})
827 displayer = logcmdutil.changesetdisplayer(ui, repo, {})
827 828
828 829 if command:
829 830 changesets = 1
@@ -1873,9 +1874,9 b' def diff(ui, repo, *pats, **opts):'
1873 1874 diffopts = patch.diffallopts(ui, opts)
1874 1875 m = scmutil.match(repo[node2], pats, opts)
1875 1876 ui.pager('diff')
1876 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
1877 listsubrepos=opts.get('subrepos'),
1878 root=opts.get('root'))
1877 logcmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
1878 listsubrepos=opts.get('subrepos'),
1879 root=opts.get('root'))
1879 1880
1880 1881 @command('^export',
1881 1882 [('o', 'output', '',
@@ -2647,7 +2648,7 b' def heads(ui, repo, *branchrevs, **opts)'
2647 2648
2648 2649 ui.pager('heads')
2649 2650 heads = sorted(heads, key=lambda x: -x.rev())
2650 displayer = cmdutil.show_changeset(ui, repo, opts)
2651 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
2651 2652 for ctx in heads:
2652 2653 displayer.show(ctx)
2653 2654 displayer.close()
@@ -3155,11 +3156,11 b' def incoming(ui, repo, source="default",'
3155 3156 """
3156 3157 opts = pycompat.byteskwargs(opts)
3157 3158 if opts.get('graph'):
3158 cmdutil.checkunsupportedgraphflags([], opts)
3159 logcmdutil.checkunsupportedgraphflags([], opts)
3159 3160 def display(other, chlist, displayer):
3160 revdag = cmdutil.graphrevs(other, chlist, opts)
3161 cmdutil.displaygraph(ui, repo, revdag, displayer,
3162 graphmod.asciiedges)
3161 revdag = logcmdutil.graphrevs(other, chlist, opts)
3162 logcmdutil.displaygraph(ui, repo, revdag, displayer,
3163 graphmod.asciiedges)
3163 3164
3164 3165 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
3165 3166 return 0
@@ -3418,16 +3419,16 b' def log(ui, repo, *pats, **opts):'
3418 3419 )
3419 3420
3420 3421 repo = scmutil.unhidehashlikerevs(repo, opts.get('rev'), 'nowarn')
3421 revs, filematcher = cmdutil.getlogrevs(repo, pats, opts)
3422 revs, filematcher = logcmdutil.getrevs(repo, pats, opts)
3422 3423 hunksfilter = None
3423 3424
3424 3425 if opts.get('graph'):
3425 3426 if linerange:
3426 3427 raise error.Abort(_('graph not supported with line range patterns'))
3427 return cmdutil.graphlog(ui, repo, revs, filematcher, opts)
3428 return logcmdutil.graphlog(ui, repo, revs, filematcher, opts)
3428 3429
3429 3430 if linerange:
3430 revs, lrfilematcher, hunksfilter = cmdutil.getloglinerangerevs(
3431 revs, lrfilematcher, hunksfilter = logcmdutil.getlinerangerevs(
3431 3432 repo, revs, opts)
3432 3433
3433 3434 if filematcher is not None and lrfilematcher is not None:
@@ -3449,7 +3450,7 b' def log(ui, repo, *pats, **opts):'
3449 3450 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
3450 3451
3451 3452 ui.pager('log')
3452 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
3453 displayer = logcmdutil.changesetdisplayer(ui, repo, opts, buffered=True)
3453 3454 for rev in revs:
3454 3455 ctx = repo[rev]
3455 3456 copies = None
@@ -3603,7 +3604,7 b' def merge(ui, repo, node=None, **opts):'
3603 3604 p2 = repo.lookup(node)
3604 3605 nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
3605 3606
3606 displayer = cmdutil.show_changeset(ui, repo, opts)
3607 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
3607 3608 for node in nodes:
3608 3609 displayer.show(repo[node])
3609 3610 displayer.close()
@@ -3667,16 +3668,17 b' def outgoing(ui, repo, dest=None, **opts'
3667 3668 """
3668 3669 opts = pycompat.byteskwargs(opts)
3669 3670 if opts.get('graph'):
3670 cmdutil.checkunsupportedgraphflags([], opts)
3671 logcmdutil.checkunsupportedgraphflags([], opts)
3671 3672 o, other = hg._outgoing(ui, repo, dest, opts)
3672 3673 if not o:
3673 3674 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3674 3675 return
3675 3676
3676 revdag = cmdutil.graphrevs(repo, o, opts)
3677 revdag = logcmdutil.graphrevs(repo, o, opts)
3677 3678 ui.pager('outgoing')
3678 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
3679 cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)
3679 displayer = logcmdutil.changesetdisplayer(ui, repo, opts, buffered=True)
3680 logcmdutil.displaygraph(ui, repo, revdag, displayer,
3681 graphmod.asciiedges)
3680 3682 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3681 3683 return 0
3682 3684
@@ -3751,7 +3753,7 b' def parents(ui, repo, file_=None, **opts'
3751 3753 else:
3752 3754 p = [cp.node() for cp in ctx.parents()]
3753 3755
3754 displayer = cmdutil.show_changeset(ui, repo, opts)
3756 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
3755 3757 for n in p:
3756 3758 if n != nullid:
3757 3759 displayer.show(repo[n])
@@ -4983,7 +4985,7 b' def summary(ui, repo, **opts):'
4983 4985 # shows a working directory parent *changeset*:
4984 4986 # i18n: column positioning for "hg summary"
4985 4987 ui.write(_('parent: %d:%s ') % (p.rev(), p),
4986 label=cmdutil._changesetlabels(p))
4988 label=logcmdutil.changesetlabels(p))
4987 4989 ui.write(' '.join(p.tags()), label='log.tag')
4988 4990 if p.bookmarks():
4989 4991 marks.extend(p.bookmarks())
@@ -5405,7 +5407,7 b' def tip(ui, repo, **opts):'
5405 5407 Returns 0 on success.
5406 5408 """
5407 5409 opts = pycompat.byteskwargs(opts)
5408 displayer = cmdutil.show_changeset(ui, repo, opts)
5410 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
5409 5411 displayer.show(repo['tip'])
5410 5412 displayer.close()
5411 5413
@@ -48,6 +48,7 b' from . import ('
48 48 hg,
49 49 localrepo,
50 50 lock as lockmod,
51 logcmdutil,
51 52 merge as mergemod,
52 53 obsolete,
53 54 obsutil,
@@ -2396,7 +2397,7 b' def debugtemplate(ui, repo, tmpl, **opts'
2396 2397 t = formatter.maketemplater(ui, tmpl, resources=tres)
2397 2398 ui.write(t.render(props))
2398 2399 else:
2399 displayer = cmdutil.makelogtemplater(ui, repo, tmpl)
2400 displayer = logcmdutil.maketemplater(ui, repo, tmpl)
2400 2401 for r in revs:
2401 2402 displayer.show(repo[r], **pycompat.strkwargs(props))
2402 2403 displayer.close()
@@ -31,6 +31,7 b' from . import ('
31 31 httppeer,
32 32 localrepo,
33 33 lock,
34 logcmdutil,
34 35 logexchange,
35 36 merge as mergemod,
36 37 node,
@@ -885,7 +886,7 b' def _incoming(displaychlist, subreporecu'
885 886 ui.status(_("no changes found\n"))
886 887 return subreporecurse()
887 888 ui.pager('incoming')
888 displayer = cmdutil.show_changeset(ui, other, opts, buffered)
889 displayer = logcmdutil.changesetdisplayer(ui, other, opts, buffered)
889 890 displaychlist(other, chlist, displayer)
890 891 displayer.close()
891 892 finally:
@@ -904,7 +905,7 b' def incoming(ui, repo, source, opts):'
904 905 return ret
905 906
906 907 def display(other, chlist, displayer):
907 limit = cmdutil.loglimit(opts)
908 limit = logcmdutil.getlimit(opts)
908 909 if opts.get('newest_first'):
909 910 chlist.reverse()
910 911 count = 0
@@ -949,7 +950,7 b' def outgoing(ui, repo, dest, opts):'
949 950 ret = min(ret, sub.outgoing(ui, dest, opts))
950 951 return ret
951 952
952 limit = cmdutil.loglimit(opts)
953 limit = logcmdutil.getlimit(opts)
953 954 o, other = _outgoing(ui, repo, dest, opts)
954 955 if not o:
955 956 cmdutil.outgoinghooks(ui, repo, other, opts, o)
@@ -958,7 +959,7 b' def outgoing(ui, repo, dest, opts):'
958 959 if opts.get('newest_first'):
959 960 o.reverse()
960 961 ui.pager('outgoing')
961 displayer = cmdutil.show_changeset(ui, repo, opts)
962 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
962 963 count = 0
963 964 for n in o:
964 965 if limit is not None and count >= limit:
@@ -2342,7 +2342,7 b' def diff(repo, node1=None, node2=None, m'
2342 2342 if hunksfilterfn is not None:
2343 2343 # If the file has been removed, fctx2 is None; but this should
2344 2344 # not occur here since we catch removed files early in
2345 # cmdutil.getloglinerangerevs() for 'hg log -L'.
2345 # logcmdutil.getlinerangerevs() for 'hg log -L'.
2346 2346 assert fctx2 is not None, \
2347 2347 'fctx2 unexpectly None in diff hunks filtering'
2348 2348 hunks = hunksfilterfn(fctx2, hunks)
@@ -411,7 +411,7 b' def intrev(ctx):'
411 411
412 412 def formatchangeid(ctx):
413 413 """Format changectx as '{rev}:{node|formatnode}', which is the default
414 template provided by cmdutil.changeset_templater"""
414 template provided by logcmdutil.changesettemplater"""
415 415 repo = ctx.repo()
416 416 return formatrevnode(repo.ui, intrev(ctx), binnode(ctx))
417 417
@@ -28,6 +28,7 b' from . import ('
28 28 error,
29 29 exchange,
30 30 filemerge,
31 logcmdutil,
31 32 match as matchmod,
32 33 node,
33 34 pathutil,
@@ -907,10 +908,10 b' class hgsubrepo(abstractsubrepo):'
907 908 # in hex format
908 909 if node2 is not None:
909 910 node2 = node.bin(node2)
910 cmdutil.diffordiffstat(ui, self._repo, diffopts,
911 node1, node2, match,
912 prefix=posixpath.join(prefix, self._path),
913 listsubrepos=True, **opts)
911 logcmdutil.diffordiffstat(ui, self._repo, diffopts,
912 node1, node2, match,
913 prefix=posixpath.join(prefix, self._path),
914 listsubrepos=True, **opts)
914 915 except error.RepoLookupError as inst:
915 916 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
916 917 % (inst, subrelpath(self)))
@@ -917,7 +917,7 b' def showinstabilities(**args):'
917 917 def showverbosity(ui, **args):
918 918 """String. The current output verbosity in 'debug', 'quiet', 'verbose',
919 919 or ''."""
920 # see cmdutil.changeset_templater for priority of these flags
920 # see logcmdutil.changesettemplater for priority of these flags
921 921 if ui.debugflag:
922 922 return 'debug'
923 923 elif ui.quiet:
@@ -115,7 +115,7 b' o (0) root'
115 115 > ui.write(smartset.prettyformat(revs) + '\n')
116 116 > revs = smartset.baseset() # display no revisions
117 117 > return revs, filematcher
118 > extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset)
118 > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
119 119 > aliases, entry = cmdutil.findcmd('log', commands.table)
120 120 > entry[1].append(('', 'print-revset', False,
121 121 > 'print generated revset and exit (DEPRECATED)'))
@@ -2421,7 +2421,7 b' working-directory revision'
2421 2421 |
2422 2422 ~
2423 2423
2424 node template with changeset_printer:
2424 node template with changesetprinter:
2425 2425
2426 2426 $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
2427 2427 7 7:02dbb8e276b8
@@ -2433,7 +2433,7 b' node template with changeset_printer:'
2433 2433 |
2434 2434 ~
2435 2435
2436 node template with changeset_templater (shared cache variable):
2436 node template with changesettemplater (shared cache variable):
2437 2437
2438 2438 $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
2439 2439 > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
@@ -4,8 +4,8 b' Test hg log changeset printer external h'
4 4 $ cat > $TESTTMP/logexthook.py <<EOF
5 5 > from __future__ import absolute_import
6 6 > from mercurial import (
7 > cmdutil,
8 7 > commands,
8 > logcmdutil,
9 9 > repair,
10 10 > )
11 11 > def rot13description(self, ctx):
@@ -13,7 +13,7 b' Test hg log changeset printer external h'
13 13 > description = ctx.description().strip().splitlines()[0].encode('rot13')
14 14 > self.ui.write("%s: %s\n" % (summary, description))
15 15 > def reposetup(ui, repo):
16 > cmdutil.changeset_printer._exthook = rot13description
16 > logcmdutil.changesetprinter._exthook = rot13description
17 17 > EOF
18 18
19 19 Prepare the repository
General Comments 0
You need to be logged in to leave comments. Login now