Commit cd53d42f authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

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
parent 572f36e9a780
......@@ -300,8 +300,8 @@ import time
from mercurial.i18n import _
from mercurial.node import short
from mercurial import (
cmdutil,
error,
logcmdutil,
mail,
registrar,
url,
......@@ -1090,9 +1090,9 @@ class bugzilla(object):
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),
......
......@@ -19,6 +19,7 @@ from __future__ import absolute_import
from mercurial.i18n import _
from mercurial import (
cmdutil,
logcmdutil,
pycompat,
registrar,
)
......@@ -65,7 +66,7 @@ def children(ui, repo, file_=None, **opts):
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()
......@@ -18,6 +18,7 @@ from mercurial.i18n import _
from mercurial import (
cmdutil,
encoding,
logcmdutil,
patch,
pycompat,
registrar,
......@@ -54,7 +55,7 @@ def countrate(ui, repo, amap, *pats, **opts):
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)
......
......@@ -29,6 +29,7 @@ from mercurial import (
hg,
localrepo,
lock,
logcmdutil,
node,
pycompat,
registrar,
......@@ -478,7 +479,7 @@ def journal(ui, repo, *args, **opts):
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 @@ def journal(ui, repo, *args, **opts):
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]
......
......@@ -101,6 +101,7 @@ from mercurial import (
extensions,
filelog,
localrepo,
logcmdutil,
match,
patch,
pathutil,
......@@ -254,7 +255,7 @@ class kwtemplater(object):
'''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)
......
......@@ -86,6 +86,7 @@ from mercurial import (
hg,
localrepo,
lock as lockmod,
logcmdutil,
patch as patchmod,
phases,
pycompat,
......@@ -743,8 +744,8 @@ class queue(object):
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
......
......@@ -142,8 +142,8 @@ import time
from mercurial.i18n import _
from mercurial import (
cmdutil,
error,
logcmdutil,
mail,
patch,
registrar,
......@@ -257,9 +257,9 @@ class notifier(object):
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.'''
......
......@@ -39,6 +39,7 @@ from mercurial import (
error,
formatter,
graphmod,
logcmdutil,
phases,
pycompat,
registrar,
......@@ -148,7 +149,7 @@ def show(ui, repo, view=None, template=None):
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 @@ def showwork(ui, repo, displayer):
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>`.
......
......@@ -24,6 +24,7 @@ from mercurial import (
error,
exchange,
hg,
logcmdutil,
match,
merge,
node as nodemod,
......@@ -501,7 +502,7 @@ def hasnode(repo, node):
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?]:'
......
......@@ -46,22 +46,6 @@ from . import (
)
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 commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
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'))
......
......@@ -41,6 +41,7 @@ from . import (
help,
hg,
lock as lockmod,
logcmdutil,
merge as mergemod,
obsolete,
obsutil,
......@@ -823,7 +824,7 @@ def bisect(ui, repo, rev=None, extra=None, command=None,
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 @@ def diff(ui, repo, *pats, **opts):
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 @@ def heads(ui, repo, *branchrevs, **opts):
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 @@ def incoming(ui, repo, source="default", **opts):
"""
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 @@ def log(ui, repo, *pats, **opts):
)
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 @@ def log(ui, repo, *pats, **opts):
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 @@ def merge(ui, repo, node=None, **opts):
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 @@ def outgoing(ui, repo, dest=None, **opts):
"""
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 @@ def parents(ui, repo, file_=None, **opts):
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 @@ def summary(ui, repo, **opts):
# 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 @@ def tip(ui, repo, **opts):
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()
......
......@@ -48,6 +48,7 @@ from . import (
hg,
localrepo,
lock as lockmod,
logcmdutil,
merge as mergemod,
obsolete,
obsutil,
......@@ -2396,7 +2397,7 @@ def debugtemplate(ui, repo, tmpl, **opts):
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()
......
......@@ -31,6 +31,7 @@ from . import (
httppeer,
localrepo,
lock,
logcmdutil,
logexchange,
merge as mergemod,
node,
......@@ -885,7 +886,7 @@ def _incoming(displaychlist, subreporecurse, ui, repo, source,
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 @@ def incoming(ui, repo, source, opts):
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 @@ def outgoing(ui, repo, dest, opts):
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 @@ def outgoing(ui, repo, dest, opts):
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:
......
......@@ -2342,7 +2342,7 @@ def diff(repo, node1=None, node2=None, match=None, changes=None,
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)
......
......@@ -411,7 +411,7 @@ def intrev(ctx):
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))
......
......@@ -28,6 +28,7 @@ from . import (
error,
exchange,
filemerge,
logcmdutil,
match as matchmod,
node,
pathutil,
......@@ -907,10 +908,10 @@ class hgsubrepo(abstractsubrepo):
# 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)))
......
......@@ -917,7 +917,7 @@ def showinstabilities(**args):
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:
......
......@@ -115,7 +115,7 @@ o (0) root
> 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 @@ working-directory revision
|
~
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_printer:
|
~
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)}'
......
......@@ -4,8 +4,8 @@ Test hg log changeset printer external hook
$ 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 @@ Test hg log changeset printer external hook
> 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment