本文整理汇总了Python中mercurial.cmdutil.show_changeset函数的典型用法代码示例。如果您正苦于以下问题:Python show_changeset函数的具体用法?Python show_changeset怎么用?Python show_changeset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_changeset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: metadata
def metadata():
base = "repo: %s\nnode: %s\nbranch: %s\n" % (hex(repo.changelog.node(0)), hex(node), ctx.branch())
tags = "".join("tag: %s\n" % t for t in ctx.tags() if repo.tagtype(t) == "global")
if not tags:
repo.ui.pushbuffer()
opts = {"template": "{latesttag}\n{latesttagdistance}", "style": "", "patch": None, "git": None}
cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
ltags, dist = repo.ui.popbuffer().split("\n")
tags = "".join("latesttag: %s\n" % t for t in ltags.split(":"))
tags += "latesttagdistance: %s\n" % dist
return base + tags
示例2: graphlog
def graphlog(ui, repo, *pats, **opts):
"""show revision history alongside an ASCII revision graph
Print a revision history alongside a revision graph drawn with
ASCII characters.
Nodes printed as an @ character are parents of the working
directory.
"""
revs, expr, filematcher = getlogrevs(repo, pats, opts)
revs = sorted(revs, reverse=1)
limit = cmdutil.loglimit(opts)
if limit is not None:
revs = revs[:limit]
revdag = graphmod.dagwalker(repo, revs)
getrenamed = None
if opts.get('copies'):
endrev = None
if opts.get('rev'):
endrev = max(scmutil.revrange(repo, opts.get('rev'))) + 1
getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
displayer = show_changeset(ui, repo, opts, buffered=True)
showparents = [ctx.node() for ctx in repo[None].parents()]
generate(ui, revdag, displayer, showparents, asciiedges, getrenamed,
filematcher)
示例3: children
def children(ui, repo, file_=None, **opts):
"""show the children of the given or working directory revision
Print the children of the working directory's revisions. If a
revision is given via -r/--rev, the children of that revision will
be printed. If a file argument is given, revision in which the
file was last changed (after the working directory revision or the
argument to --rev if given) is printed.
Please use :hg:`log` instead::
hg children => hg log -r 'children()'
hg children -r REV => hg log -r 'children(REV)'
See :hg:`help log` and :hg:`help revsets.children`.
"""
rev = opts.get('rev')
if file_:
fctx = repo.filectx(file_, changeid=rev)
childctxs = [fcctx.changectx() for fcctx in fctx.children()]
else:
ctx = repo[rev]
childctxs = ctx.children()
displayer = cmdutil.show_changeset(ui, repo, opts)
for cctx in childctxs:
displayer.show(cctx)
displayer.close()
示例4: metadata
def metadata():
base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
hex(repo.changelog.node(0)), hex(node), ctx.branch())
tags = ''.join('tag: %s\n' % t for t in ctx.tags()
if repo.tagtype(t) == 'global')
if not tags:
repo.ui.pushbuffer()
opts = {'template': '{latesttag}\n{latesttagdistance}',
'style': '', 'patch': None, 'git': None}
cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
ltags, dist = repo.ui.popbuffer().split('\n')
tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':'))
tags += 'latesttagdistance: %s\n' % dist
return base + tags
示例5: outgoing
def outgoing(self):
limit = cmdutil.loglimit(opts)
dest, revs, checkout = hg.parseurl(
ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
if revs:
revs = [repo.lookup(rev) for rev in revs]
other = hg.repository(cmdutil.remoteui(repo, opts), dest)
ui.status(_('comparing with %s\n') % url.hidepassword(dest))
o = repo.findoutgoing(other, force=opts.get('force'))
if not o:
ui.status(_("no changes found\n"))
return 1
o = repo.changelog.nodesbetween(o, revs)[0]
if opts.get('newest_first'):
o.reverse()
displayer = cmdutil.show_changeset(ui, repo, opts)
count = 0
for n in o:
if count >= limit:
break
parents = [p for p in repo.changelog.parents(n) if p != nullid]
if opts.get('no_merges') and len(parents) == 2:
continue
count += 1
displayer.show(repo[n])
示例6: graphlog
def graphlog(ui, repo, path=None, **opts):
"""show revision history alongside an ASCII revision graph
Print a revision history alongside a revision graph drawn with
ASCII characters.
Nodes printed as an @ character are parents of the working
directory.
"""
check_unsupported_flags(opts)
limit = cmdutil.loglimit(opts)
start, stop = get_revs(repo, opts["rev"])
if start == nullrev:
return
if path:
path = util.canonpath(repo.root, os.getcwd(), path)
if path: # could be reset in canonpath
revdag = graphmod.filerevs(repo, path, start, stop, limit)
else:
if limit is not None:
stop = max(stop, start - limit + 1)
revdag = graphmod.revisions(repo, start, stop)
displayer = show_changeset(ui, repo, opts, buffered=True)
showparents = [ctx.node() for ctx in repo[None].parents()]
generate(ui, revdag, displayer, showparents, asciiedges)
示例7: goutgoing
def goutgoing(ui, repo, dest=None, **opts):
"""show the outgoing changesets alongside an ASCII revision graph
Print the outgoing changesets alongside a revision graph drawn with
ASCII characters.
Nodes printed as an @ character are parents of the working
directory.
"""
check_unsupported_flags(opts)
dest = ui.expandpath(dest or 'default-push', dest or 'default')
dest, branches = hg.parseurl(dest, opts.get('branch'))
revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
other = hg.repository(cmdutil.remoteui(ui, opts), dest)
if revs:
revs = [repo.lookup(rev) for rev in revs]
ui.status(_('comparing with %s\n') % url.hidepassword(dest))
o = repo.findoutgoing(other, force=opts.get('force'))
if not o:
ui.status(_("no changes found\n"))
return
o = repo.changelog.nodesbetween(o, revs)[0]
revdag = graphrevs(repo, o, opts)
displayer = show_changeset(ui, repo, opts, buffered=True)
showparents = [ctx.node() for ctx in repo[None].parents()]
generate(ui, revdag, displayer, showparents, asciiedges)
示例8: get_rev_msg
def get_rev_msg(self, revision_hash, template=TEMPLATE):
self.displayer = show_changeset(self.ui, self.repo, {'template': template}, False)
self.ui.pushbuffer()
rev = self.repo.lookup(revision_hash)
ctx = context.changectx(self.repo, rev)
self.displayer.show(ctx)
msg = self.ui.popbuffer()
return msg
示例9: incoming
def incoming(self):
limit = cmdutil.loglimit(opts)
source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
other = hg.repository(cmdutil.remoteui(repo, opts), source)
ui.status(_('comparing with %s\n') % url.hidepassword(source))
if revs:
revs = [other.lookup(rev) for rev in revs]
common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
force=opts["force"])
if not incoming:
try:
os.unlink(opts["bundle"])
except:
pass
ui.status(_("no changes found\n"))
return 1
cleanup = None
try:
fname = opts["bundle"]
if fname or not other.local():
# create a bundle (uncompressed if other repo is not local)
if revs is None and other.capable('changegroupsubset'):
revs = rheads
if revs is None:
cg = other.changegroup(incoming, "incoming")
else:
cg = other.changegroupsubset(incoming, revs, 'incoming')
bundletype = other.local() and "HG10BZ" or "HG10UN"
fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
# keep written bundle?
if opts["bundle"]:
cleanup = None
if not other.local():
# use the created uncompressed bundlerepo
other = bundlerepo.bundlerepository(ui, repo.root, fname)
o = other.changelog.nodesbetween(incoming, revs)[0]
if opts.get('newest_first'):
o.reverse()
displayer = cmdutil.show_changeset(ui, other, opts)
count = 0
for n in o:
if count >= limit:
break
parents = [p for p in other.changelog.parents(n) if p != nullid]
if opts.get('no_merges') and len(parents) == 2:
continue
count += 1
displayer.show(other[n])
finally:
if hasattr(other, 'close'):
other.close()
if cleanup:
os.unlink(cleanup)
示例10: heads
def heads(self, repo):
""" Show the head revisions """
heads = repo.heads()
repo.ui.pushbuffer()
displayer = cmdutil.show_changeset(repo.ui, repo, {})
for n in heads:
displayer.show(changenode=n)
text = repo.ui.popbuffer()
return text
示例11: gincoming
def gincoming(ui, repo, source="default", **opts):
"""show the incoming changesets alongside an ASCII revision graph
Print the incoming changesets alongside a revision graph drawn with
ASCII characters.
Nodes printed as an @ character are parents of the working
directory.
"""
check_unsupported_flags(opts)
source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
other = hg.repository(cmdutil.remoteui(repo, opts), source)
revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
ui.status(_('comparing with %s\n') % url.hidepassword(source))
if revs:
revs = [other.lookup(rev) for rev in revs]
incoming = repo.findincoming(other, heads=revs, force=opts["force"])
if not incoming:
try:
os.unlink(opts["bundle"])
except:
pass
ui.status(_("no changes found\n"))
return
cleanup = None
try:
fname = opts["bundle"]
if fname or not other.local():
# create a bundle (uncompressed if other repo is not local)
if revs is None:
cg = other.changegroup(incoming, "incoming")
else:
cg = other.changegroupsubset(incoming, revs, 'incoming')
bundletype = other.local() and "HG10BZ" or "HG10UN"
fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
# keep written bundle?
if opts["bundle"]:
cleanup = None
if not other.local():
# use the created uncompressed bundlerepo
other = bundlerepo.bundlerepository(ui, repo.root, fname)
chlist = other.changelog.nodesbetween(incoming, revs)[0]
revdag = graphrevs(other, chlist, opts)
displayer = show_changeset(ui, other, opts, buffered=True)
showparents = [ctx.node() for ctx in repo[None].parents()]
generate(ui, revdag, displayer, showparents, asciiedges)
finally:
if hasattr(other, 'close'):
other.close()
if cleanup:
os.unlink(cleanup)
示例12: parents
def parents(self, repo):
""" Show the parent revisions """
p = repo.dirstate.parents()
repo.ui.pushbuffer()
displayer = cmdutil.show_changeset(repo.ui, repo, {})
for n in p:
if n != nullid:
displayer.show(changenode=n)
text = repo.ui.popbuffer()
return text
示例13: asciiformat
def asciiformat(ui, repo, revdag, opts, parentrepo=None):
"""formats a changelog DAG walk for ASCII output"""
if parentrepo is None:
parentrepo = repo
showparents = [ctx.node() for ctx in parentrepo[None].parents()]
displayer = show_changeset(ui, repo, opts, buffered=True)
for (id, type, ctx, parentids) in revdag:
if type != graphmod.CHANGESET:
continue
displayer.show(ctx)
lines = displayer.hunk.pop(ctx.rev()).split('\n')[:-1]
char = ctx.node() in showparents and '@' or 'o'
yield (id, ASCIIDATA, (char, lines), parentids)
示例14: parents
def parents(orig, ui, repo, *args, **opts):
"""show Mercurial & Subversion parents of the working dir or revision
"""
if not opts.get('svn', False):
return orig(ui, repo, *args, **opts)
meta = repo.svnmeta()
hashes = meta.revmap.hashes()
ha = util.parentrev(ui, repo, meta, hashes)
if ha.node() == node.nullid:
raise hgutil.Abort('No parent svn revision!')
displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False)
displayer.show(ha)
return 0
示例15: _showchangesets
def _showchangesets(ui, repo, contexts=None, revs=None):
"""Pretty print a list of changesets. Can take either a list of
change contexts or a list of revision numbers.
"""
if contexts is None:
contexts = []
if revs is not None:
contexts.extend(repo[r] for r in revs)
showopts = {
'template': '[{shortest(node, 6)}] {if(bookmarks, "({bookmarks}) ")}'
'{desc|firstline}\n'
}
displayer = cmdutil.show_changeset(ui, repo, showopts)
for ctx in contexts:
displayer.show(ctx)