Mercurial > hg
changeset 35888:c8e2d6ed1f9e
cmdutil: drop aliases for logcmdutil functions (API)
.. api::
Log-related utility functions has been renamed as follows:
- cmdutil.loglimit -> logcmdutil.getlimit
- cmdutil.diffordiffstat -> logcmdutil.diffordiffstat
- cmdutil._changesetlabels -> logcmdutil.changesetlabels
- cmdutil.changeset_printer -> logcmdutil.changesetprinter
- cmdutil.jsonchangeset = logcmdutil.jsonchangeset
- cmdutil.changeset_templater -> logcmdutil.changesettemplater
- cmdutil.logtemplatespec -> logcmdutil.templatespec
- cmdutil.makelogtemplater -> logcmdutil.maketemplater
- cmdutil.show_changeset -> logcmdutil.changesetdisplayer
- cmdutil.getlogrevs -> logcmdutil.getrevs
- cmdutil.getloglinerangerevs -> logcmdutil.getlinerangerevs
- cmdutil.displaygraph -> logcmdutil.displaygraph
- cmdutil.graphlog -> logcmdutil.graphlog
- cmdutil.checkunsupportedgraphflags -> logcmdutil.checkunsupportedgraphflags
- cmdutil.graphrevs -> logcmdutil.graphrevs
- cmdutil._makenofollowlogfilematcher -> logcmdutil._makenofollowfilematcher
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Jan 2018 13:03:03 +0900 |
parents | 572f36e9a780 |
children | e49c39ffeac2 |
files | hgext/bugzilla.py hgext/children.py hgext/churn.py hgext/journal.py hgext/keyword.py hgext/mq.py hgext/notify.py hgext/show.py hgext/transplant.py mercurial/cmdutil.py mercurial/commands.py mercurial/debugcommands.py mercurial/hg.py mercurial/patch.py mercurial/scmutil.py mercurial/subrepo.py mercurial/templatekw.py tests/test-glog.t tests/test-log-exthook.t |
diffstat | 19 files changed, 71 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bugzilla.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/bugzilla.py Sun Jan 21 13:03:03 2018 +0900 @@ -300,8 +300,8 @@ from mercurial.i18n import _ from mercurial.node import short from mercurial import ( - cmdutil, error, + logcmdutil, mail, registrar, url, @@ -1090,9 +1090,9 @@ if not mapfile and not tmpl: tmpl = _('changeset {node|short} in repo {root} refers ' 'to bug {bug}.\ndetails:\n\t{desc|tabindent}') - spec = cmdutil.logtemplatespec(tmpl, mapfile) - t = cmdutil.changeset_templater(self.ui, self.repo, spec, - False, None, False) + spec = logcmdutil.templatespec(tmpl, mapfile) + t = logcmdutil.changesettemplater(self.ui, self.repo, spec, + False, None, False) self.ui.pushbuffer() t.show(ctx, changes=ctx.changeset(), bug=str(bugid),
--- a/hgext/children.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/children.py Sun Jan 21 13:03:03 2018 +0900 @@ -19,6 +19,7 @@ from mercurial.i18n import _ from mercurial import ( cmdutil, + logcmdutil, pycompat, registrar, ) @@ -65,7 +66,7 @@ ctx = repo[rev] childctxs = ctx.children() - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) for cctx in childctxs: displayer.show(cctx) displayer.close()
--- a/hgext/churn.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/churn.py Sun Jan 21 13:03:03 2018 +0900 @@ -18,6 +18,7 @@ from mercurial import ( cmdutil, encoding, + logcmdutil, patch, pycompat, registrar, @@ -54,7 +55,7 @@ return date.strftime(opts['dateformat']) else: tmpl = opts.get('oldtemplate') or opts.get('template') - tmpl = cmdutil.makelogtemplater(ui, repo, tmpl) + tmpl = logcmdutil.maketemplater(ui, repo, tmpl) def getkey(ctx): ui.pushbuffer() tmpl.show(ctx)
--- a/hgext/journal.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/journal.py Sun Jan 21 13:03:03 2018 +0900 @@ -29,6 +29,7 @@ hg, localrepo, lock, + logcmdutil, node, pycompat, registrar, @@ -478,7 +479,7 @@ displayname = "'%s'" % name ui.status(_("previous locations of %s:\n") % displayname) - limit = cmdutil.loglimit(opts) + limit = logcmdutil.getlimit(opts) entry = None ui.pager('journal') for count, entry in enumerate(repo.journal.filtered(name=name)): @@ -502,7 +503,8 @@ fm.write('command', ' %s\n', entry.command) if opts.get("commits"): - displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts, + buffered=False) for hash in entry.newhashes: try: ctx = repo[hash]
--- a/hgext/keyword.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/keyword.py Sun Jan 21 13:03:03 2018 +0900 @@ -101,6 +101,7 @@ extensions, filelog, localrepo, + logcmdutil, match, patch, pathutil, @@ -254,7 +255,7 @@ '''Replaces keywords in data with expanded template.''' def kwsub(mobj): kw = mobj.group(1) - ct = cmdutil.makelogtemplater(self.ui, self.repo, + ct = logcmdutil.maketemplater(self.ui, self.repo, self.templates[kw]) self.ui.pushbuffer() ct.show(ctx, root=self.repo.root, file=path)
--- a/hgext/mq.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/mq.py Sun Jan 21 13:03:03 2018 +0900 @@ -86,6 +86,7 @@ hg, localrepo, lock as lockmod, + logcmdutil, patch as patchmod, phases, pycompat, @@ -743,8 +744,8 @@ opts = {} stat = opts.get('stat') m = scmutil.match(repo[node1], files, opts) - cmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m, - changes, stat, fp) + logcmdutil.diffordiffstat(self.ui, repo, diffopts, node1, node2, m, + changes, stat, fp) def mergeone(self, repo, mergeq, head, patch, rev, diffopts): # first try just applying the patch
--- a/hgext/notify.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/notify.py Sun Jan 21 13:03:03 2018 +0900 @@ -142,8 +142,8 @@ from mercurial.i18n import _ from mercurial import ( - cmdutil, error, + logcmdutil, mail, patch, registrar, @@ -257,9 +257,9 @@ mapfile = self.ui.config('notify', 'style') if not mapfile and not template: template = deftemplates.get(hooktype) or single_template - spec = cmdutil.logtemplatespec(template, mapfile) - self.t = cmdutil.changeset_templater(self.ui, self.repo, spec, - False, None, False) + spec = logcmdutil.templatespec(template, mapfile) + self.t = logcmdutil.changesettemplater(self.ui, self.repo, spec, + False, None, False) def strip(self, path): '''strip leading slashes from local path, turn into web-safe path.'''
--- a/hgext/show.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/show.py Sun Jan 21 13:03:03 2018 +0900 @@ -39,6 +39,7 @@ error, formatter, graphmod, + logcmdutil, phases, pycompat, registrar, @@ -148,7 +149,7 @@ elif fn._csettopic: ref = 'show%s' % fn._csettopic spec = formatter.lookuptemplate(ui, ref, template) - displayer = cmdutil.changeset_templater(ui, repo, spec, buffered=True) + displayer = logcmdutil.changesettemplater(ui, repo, spec, buffered=True) return fn(ui, repo, displayer) else: return fn(ui, repo) @@ -409,8 +410,8 @@ revdag = graphmod.dagwalker(repo, revs) ui.setconfig('experimental', 'graphshorten', True) - cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, - props={'nodelen': nodelen}) + logcmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, + props={'nodelen': nodelen}) def extsetup(ui): # Alias `hg <prefix><view>` to `hg show <view>`.
--- a/hgext/transplant.py Sun Jan 21 12:48:39 2018 +0900 +++ b/hgext/transplant.py Sun Jan 21 13:03:03 2018 +0900 @@ -24,6 +24,7 @@ error, exchange, hg, + logcmdutil, match, merge, node as nodemod, @@ -501,7 +502,7 @@ def browserevs(ui, repo, nodes, opts): '''interactively transplant changesets''' - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) transplants = [] merges = [] prompt = _('apply changeset? [ynmpcq?]:'
--- a/mercurial/cmdutil.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/cmdutil.py Sun Jan 21 13:03:03 2018 +0900 @@ -46,22 +46,6 @@ ) stringio = util.stringio -loglimit = logcmdutil.getlimit -diffordiffstat = logcmdutil.diffordiffstat -_changesetlabels = logcmdutil.changesetlabels -changeset_printer = logcmdutil.changesetprinter -jsonchangeset = logcmdutil.jsonchangeset -changeset_templater = logcmdutil.changesettemplater -logtemplatespec = logcmdutil.templatespec -makelogtemplater = logcmdutil.maketemplater -show_changeset = logcmdutil.changesetdisplayer -getlogrevs = logcmdutil.getrevs -getloglinerangerevs = logcmdutil.getlinerangerevs -displaygraph = logcmdutil.displaygraph -graphlog = logcmdutil.graphlog -checkunsupportedgraphflags = logcmdutil.checkunsupportedgraphflags -graphrevs = logcmdutil.graphrevs - # templates of common command options dryrunopts = [ @@ -2526,7 +2510,7 @@ def buildcommittemplate(repo, ctx, subs, extramsg, ref): ui = repo.ui spec = formatter.templatespec(ref, None, None) - t = changeset_templater(ui, repo, spec, None, {}, False) + t = logcmdutil.changesettemplater(ui, repo, spec, None, {}, False) t.t.cache.update((k, templater.unquotestring(v)) for k, v in repo.ui.configitems('committemplate'))
--- a/mercurial/commands.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/commands.py Sun Jan 21 13:03:03 2018 +0900 @@ -41,6 +41,7 @@ help, hg, lock as lockmod, + logcmdutil, merge as mergemod, obsolete, obsutil, @@ -823,7 +824,7 @@ cmdutil.bailifchanged(repo) return hg.clean(repo, node, show_stats=show_stats) - displayer = cmdutil.show_changeset(ui, repo, {}) + displayer = logcmdutil.changesetdisplayer(ui, repo, {}) if command: changesets = 1 @@ -1873,9 +1874,9 @@ diffopts = patch.diffallopts(ui, opts) m = scmutil.match(repo[node2], pats, opts) ui.pager('diff') - cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, - listsubrepos=opts.get('subrepos'), - root=opts.get('root')) + logcmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, + listsubrepos=opts.get('subrepos'), + root=opts.get('root')) @command('^export', [('o', 'output', '', @@ -2647,7 +2648,7 @@ ui.pager('heads') heads = sorted(heads, key=lambda x: -x.rev()) - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) for ctx in heads: displayer.show(ctx) displayer.close() @@ -3155,11 +3156,11 @@ """ opts = pycompat.byteskwargs(opts) if opts.get('graph'): - cmdutil.checkunsupportedgraphflags([], opts) + logcmdutil.checkunsupportedgraphflags([], opts) def display(other, chlist, displayer): - revdag = cmdutil.graphrevs(other, chlist, opts) - cmdutil.displaygraph(ui, repo, revdag, displayer, - graphmod.asciiedges) + revdag = logcmdutil.graphrevs(other, chlist, opts) + logcmdutil.displaygraph(ui, repo, revdag, displayer, + graphmod.asciiedges) hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) return 0 @@ -3418,16 +3419,16 @@ ) repo = scmutil.unhidehashlikerevs(repo, opts.get('rev'), 'nowarn') - revs, filematcher = cmdutil.getlogrevs(repo, pats, opts) + revs, filematcher = logcmdutil.getrevs(repo, pats, opts) hunksfilter = None if opts.get('graph'): if linerange: raise error.Abort(_('graph not supported with line range patterns')) - return cmdutil.graphlog(ui, repo, revs, filematcher, opts) + return logcmdutil.graphlog(ui, repo, revs, filematcher, opts) if linerange: - revs, lrfilematcher, hunksfilter = cmdutil.getloglinerangerevs( + revs, lrfilematcher, hunksfilter = logcmdutil.getlinerangerevs( repo, revs, opts) if filematcher is not None and lrfilematcher is not None: @@ -3449,7 +3450,7 @@ getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) ui.pager('log') - displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts, buffered=True) for rev in revs: ctx = repo[rev] copies = None @@ -3603,7 +3604,7 @@ p2 = repo.lookup(node) nodes = repo.changelog.findmissing(common=[p1], heads=[p2]) - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) for node in nodes: displayer.show(repo[node]) displayer.close() @@ -3667,16 +3668,17 @@ """ opts = pycompat.byteskwargs(opts) if opts.get('graph'): - cmdutil.checkunsupportedgraphflags([], opts) + logcmdutil.checkunsupportedgraphflags([], opts) o, other = hg._outgoing(ui, repo, dest, opts) if not o: cmdutil.outgoinghooks(ui, repo, other, opts, o) return - revdag = cmdutil.graphrevs(repo, o, opts) + revdag = logcmdutil.graphrevs(repo, o, opts) ui.pager('outgoing') - displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) - cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts, buffered=True) + logcmdutil.displaygraph(ui, repo, revdag, displayer, + graphmod.asciiedges) cmdutil.outgoinghooks(ui, repo, other, opts, o) return 0 @@ -3751,7 +3753,7 @@ else: p = [cp.node() for cp in ctx.parents()] - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) for n in p: if n != nullid: displayer.show(repo[n]) @@ -4983,7 +4985,7 @@ # shows a working directory parent *changeset*: # i18n: column positioning for "hg summary" ui.write(_('parent: %d:%s ') % (p.rev(), p), - label=cmdutil._changesetlabels(p)) + label=logcmdutil.changesetlabels(p)) ui.write(' '.join(p.tags()), label='log.tag') if p.bookmarks(): marks.extend(p.bookmarks()) @@ -5405,7 +5407,7 @@ Returns 0 on success. """ opts = pycompat.byteskwargs(opts) - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) displayer.show(repo['tip']) displayer.close()
--- a/mercurial/debugcommands.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/debugcommands.py Sun Jan 21 13:03:03 2018 +0900 @@ -48,6 +48,7 @@ hg, localrepo, lock as lockmod, + logcmdutil, merge as mergemod, obsolete, obsutil, @@ -2396,7 +2397,7 @@ t = formatter.maketemplater(ui, tmpl, resources=tres) ui.write(t.render(props)) else: - displayer = cmdutil.makelogtemplater(ui, repo, tmpl) + displayer = logcmdutil.maketemplater(ui, repo, tmpl) for r in revs: displayer.show(repo[r], **pycompat.strkwargs(props)) displayer.close()
--- a/mercurial/hg.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/hg.py Sun Jan 21 13:03:03 2018 +0900 @@ -31,6 +31,7 @@ httppeer, localrepo, lock, + logcmdutil, logexchange, merge as mergemod, node, @@ -885,7 +886,7 @@ ui.status(_("no changes found\n")) return subreporecurse() ui.pager('incoming') - displayer = cmdutil.show_changeset(ui, other, opts, buffered) + displayer = logcmdutil.changesetdisplayer(ui, other, opts, buffered) displaychlist(other, chlist, displayer) displayer.close() finally: @@ -904,7 +905,7 @@ return ret def display(other, chlist, displayer): - limit = cmdutil.loglimit(opts) + limit = logcmdutil.getlimit(opts) if opts.get('newest_first'): chlist.reverse() count = 0 @@ -949,7 +950,7 @@ ret = min(ret, sub.outgoing(ui, dest, opts)) return ret - limit = cmdutil.loglimit(opts) + limit = logcmdutil.getlimit(opts) o, other = _outgoing(ui, repo, dest, opts) if not o: cmdutil.outgoinghooks(ui, repo, other, opts, o) @@ -958,7 +959,7 @@ if opts.get('newest_first'): o.reverse() ui.pager('outgoing') - displayer = cmdutil.show_changeset(ui, repo, opts) + displayer = logcmdutil.changesetdisplayer(ui, repo, opts) count = 0 for n in o: if limit is not None and count >= limit:
--- a/mercurial/patch.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/patch.py Sun Jan 21 13:03:03 2018 +0900 @@ -2342,7 +2342,7 @@ if hunksfilterfn is not None: # If the file has been removed, fctx2 is None; but this should # not occur here since we catch removed files early in - # cmdutil.getloglinerangerevs() for 'hg log -L'. + # logcmdutil.getlinerangerevs() for 'hg log -L'. assert fctx2 is not None, \ 'fctx2 unexpectly None in diff hunks filtering' hunks = hunksfilterfn(fctx2, hunks)
--- a/mercurial/scmutil.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/scmutil.py Sun Jan 21 13:03:03 2018 +0900 @@ -411,7 +411,7 @@ def formatchangeid(ctx): """Format changectx as '{rev}:{node|formatnode}', which is the default - template provided by cmdutil.changeset_templater""" + template provided by logcmdutil.changesettemplater""" repo = ctx.repo() return formatrevnode(repo.ui, intrev(ctx), binnode(ctx))
--- a/mercurial/subrepo.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/subrepo.py Sun Jan 21 13:03:03 2018 +0900 @@ -28,6 +28,7 @@ error, exchange, filemerge, + logcmdutil, match as matchmod, node, pathutil, @@ -907,10 +908,10 @@ # in hex format if node2 is not None: node2 = node.bin(node2) - cmdutil.diffordiffstat(ui, self._repo, diffopts, - node1, node2, match, - prefix=posixpath.join(prefix, self._path), - listsubrepos=True, **opts) + logcmdutil.diffordiffstat(ui, self._repo, diffopts, + node1, node2, match, + prefix=posixpath.join(prefix, self._path), + listsubrepos=True, **opts) except error.RepoLookupError as inst: self.ui.warn(_('warning: error "%s" in subrepository "%s"\n') % (inst, subrelpath(self)))
--- a/mercurial/templatekw.py Sun Jan 21 12:48:39 2018 +0900 +++ b/mercurial/templatekw.py Sun Jan 21 13:03:03 2018 +0900 @@ -917,7 +917,7 @@ def showverbosity(ui, **args): """String. The current output verbosity in 'debug', 'quiet', 'verbose', or ''.""" - # see cmdutil.changeset_templater for priority of these flags + # see logcmdutil.changesettemplater for priority of these flags if ui.debugflag: return 'debug' elif ui.quiet:
--- a/tests/test-glog.t Sun Jan 21 12:48:39 2018 +0900 +++ b/tests/test-glog.t Sun Jan 21 13:03:03 2018 +0900 @@ -115,7 +115,7 @@ > ui.write(smartset.prettyformat(revs) + '\n') > revs = smartset.baseset() # display no revisions > return revs, filematcher - > extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset) + > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset) > aliases, entry = cmdutil.findcmd('log', commands.table) > entry[1].append(('', 'print-revset', False, > 'print generated revset and exit (DEPRECATED)')) @@ -2421,7 +2421,7 @@ | ~ -node template with changeset_printer: +node template with changesetprinter: $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"' 7 7:02dbb8e276b8 @@ -2433,7 +2433,7 @@ | ~ -node template with changeset_templater (shared cache variable): +node template with changesettemplater (shared cache variable): $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \ > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
--- a/tests/test-log-exthook.t Sun Jan 21 12:48:39 2018 +0900 +++ b/tests/test-log-exthook.t Sun Jan 21 13:03:03 2018 +0900 @@ -4,8 +4,8 @@ $ cat > $TESTTMP/logexthook.py <<EOF > from __future__ import absolute_import > from mercurial import ( - > cmdutil, > commands, + > logcmdutil, > repair, > ) > def rot13description(self, ctx): @@ -13,7 +13,7 @@ > description = ctx.description().strip().splitlines()[0].encode('rot13') > self.ui.write("%s: %s\n" % (summary, description)) > def reposetup(ui, repo): - > cmdutil.changeset_printer._exthook = rot13description + > logcmdutil.changesetprinter._exthook = rot13description > EOF Prepare the repository