本文整理汇总了Python中mercurial.revset.getargs函数的典型用法代码示例。如果您正苦于以下问题:Python getargs函数的具体用法?Python getargs怎么用?Python getargs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getargs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: revset_fromgit
def revset_fromgit(repo, subset, x):
'''``fromgit()``
Select changesets that originate from Git.
'''
revset.getargs(x, 0, 0, "fromgit takes no arguments")
git = repo.githandler
node = repo.changelog.node
return [r for r in subset if git.map_git_get(hex(node(r))) is not None]
示例2: fxheadsrevset
def fxheadsrevset(repo, subset, x):
"""``fxheads()``
Last known head commits of pulled Firefox trees.
"""
revset.getargs(x, 0, 0, _("fxheads takes no arguments"))
r = revset.baseset(repo[node].rev()
for t, node, tr, u in get_firefoxtrees(repo))
return r & subset
示例3: _revsetdestrebase
def _revsetdestrebase(repo, subset, x):
# ``_rebasedefaultdest()``
# default destination for rebase.
# # XXX: Currently private because I expect the signature to change.
# # XXX: - taking rev as arguments,
# # XXX: - bailing out in case of ambiguity vs returning all data.
# # XXX: - probably merging with the merge destination.
# i18n: "_rebasedefaultdest" is a keyword
revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments"))
return subset & revset.baseset([_destrebase(repo)])
示例4: grepdiffpredicate
def grepdiffpredicate(repo, subset, x):
"""grepdiff: a revset for code archeology
Sample usages are:
$ hg log --rev "grepdiff('add:command')" mercurial/commands.py
will only match changesets that add 'command' somewhere in the diff
$ hg log --rev "grepdiff('remove:command')" mercurial/commands.py
will match changesets which remove 'command' somewhere in the diff
$ hg log --rev "grepdiff('delta:command') mercurial/commands.py"
will mathc changesets where the number of 'command' adds is different
from the number of 'command' removes in the diff
$ hg log --rev "grepdiff('touch:command')"
will only match changesets which either add or remove 'command' at
least once in the diff
$ hg log --rev "grepdiff('inc:command')" folder/file1.py folder/file2.py
will match changesets which increase the number of occurrences
of 'command' in the specified files
$ hg log --rev "grepdiff('dec:command')"
will match changesets which decrease the number of occurrences
of 'command'
"""
err = _("wrong set of arguments passed to grepdiff revset")
args = revset.getargs(x, 1, -1, err)
files = None
if len(args) > 1:
files = set(pathutil.canonpath(repo.root, repo.getcwd(), arg[1])
for arg in args[1:])
pattern, processor = getpatternandprocessor(repo, args)
def matcher(rev):
res = processor(*ctxaddsremoves(repo[rev], files, pattern))
return res
resset = subset.filter(matcher)
return resset
示例5: revset_fromgit
def revset_fromgit(repo, subset, x):
'''``fromgit()``
Select changesets that originate from Git.
'''
args = revset.getargs(x, 0, 0, "fromgit takes no arguments")
git = GitHandler(repo, repo.ui)
return [r for r in subset if git.map_git_get(repo[r].hex()) is not None]
示例6: remotebranchesrevset
def remotebranchesrevset(repo, subset, x):
"""``remotebranches()``
All remote branches heads.
"""
args = revset.getargs(x, 0, 0, "remotebranches takes no arguments")
remoterevs = set(repo[n].rev() for n in repo._remotebranches.itervalues())
return baseset([r for r in subset if r in remoterevs])
示例7: revset_svnrev
def revset_svnrev(repo, subset, x):
'''``svnrev(number)``
Select changesets that originate in the given Subversion revision.
'''
args = revset.getargs(x, 1, 1, "svnrev takes one argument")
rev = revset.getstring(args[0],
"the argument to svnrev() must be a number")
try:
revnum = int(rev)
except ValueError:
raise error.ParseError("the argument to svnrev() must be a number")
rev = rev + ' '
revs = []
meta = repo.svnmeta(skiperrorcheck=True)
try:
for l in maps.RevMap.readmapfile(meta.revmap_file, missingok=False):
if l.startswith(rev):
n = l.split(' ', 2)[1]
r = repo[node.bin(n)].rev()
if r in subset:
revs.append(r)
return revs
except IOError, err:
if err.errno != errno.ENOENT:
raise
raise hgutil.Abort("svn metadata is missing - "
"run 'hg svn rebuildmeta' to reconstruct it")
示例8: revset_pushhead
def revset_pushhead(repo, subset, x):
"""``pushhead()``
Changesets that were heads when they were pushed.
A push head is a changeset that was a head at the time it was pushed.
"""
revset.getargs(x, 0, 0, 'pushhead takes no arguments')
# Iterating over all pushlog data is unfortunate, as there is overhead
# involved. However, this is less overhead than issuing a SQL query for
# every changeset, especially on large repositories. There is room to make
# this optimal by batching SQL, but that adds complexity. For now,
# simplicity wins.
def getrevs():
for pushid, who, when, nodes in repo.pushlog.pushes():
yield repo[nodes[-1]].rev()
return subset & revset.generatorset(getrevs())
示例9: upstream
def upstream(repo, subset, x):
"""``upstream()``
Select changesets in an upstream repository according to remotebranches.
"""
args = revset.getargs(x, 0, 0, "upstream takes no arguments")
upstream_names = [s + "/" for s in repo.ui.configlist("remotebranches", "upstream")]
if not upstream_names:
filt = lambda x: True
else:
filt = lambda name: any(map(name.startswith, upstream_names))
return upstream_revs(filt, repo, subset, x)
示例10: revset_fromsvn
def revset_fromsvn(repo, subset, x):
'''``fromsvn()``
Select changesets that originate from Subversion.
'''
args = revset.getargs(x, 0, 0, "fromsvn takes no arguments")
def matches(r):
convertinfo = repo[r].extra().get('convert_revision', '')
return convertinfo[:4] == 'svn:'
return [r for r in subset if matches(r)]
示例11: gitnode
def gitnode(repo, subset, x):
"""``gitnode(id)``
Return the hg revision corresponding to a given git rev."""
l = revset.getargs(x, 1, 1, _("id requires one argument"))
n = revset.getstring(l[0], _("id requires a string"))
hexhgnode = _lookup_node(repo, n, from_scm_type='git')
if not hexhgnode:
raise error.RepoLookupError(_("unknown revision '%s'") % n)
rev = repo[hexhgnode].rev()
return subset.filter(lambda r: r == rev)
示例12: revset_gitnode
def revset_gitnode(repo, subset, x):
'''``gitnode(hash)``
Select changesets that originate in the given Git revision.
'''
args = revset.getargs(x, 1, 1, "gitnode takes one argument")
rev = revset.getstring(args[0],
"the argument to gitnode() must be a hash")
git = GitHandler(repo, repo.ui)
def matches(r):
gitnode = git.map_git_get(repo[r].hex())
if gitnode is None:
return False
return rev in [gitnode, gitnode[:12]]
return [r for r in subset if matches(r)]
示例13: revset_pushdate
def revset_pushdate(repo, subset, x):
"""``pushdate(interval)``
Changesets that were pushed within the interval, see :hg:`help dates`.
"""
l = revset.getargs(x, 1, 1, 'pushdate requires one argument')
ds = revset.getstring(l[0], 'pushdate requires a string argument')
dm = util.matchdate(ds)
def getrevs():
for pushid, who, when, nodes in repo.pushlog.pushes():
if dm(when):
for node in nodes:
yield repo[node].rev()
return subset & revset.generatorset(getrevs())
示例14: bmrevset
def bmrevset(repo, subset, x):
"""``bookmark([name])``
The named bookmark or all bookmarks.
"""
# i18n: "bookmark" is a keyword
args = revset.getargs(x, 0, 1, _('bookmark takes one or no arguments'))
if args:
bm = revset.getstring(args[0],
# i18n: "bookmark" is a keyword
_('the argument to bookmark must be a string'))
bmrev = listbookmarks(repo).get(bm, None)
if bmrev:
bmrev = repo.changelog.rev(bin(bmrev))
return [r for r in subset if r == bmrev]
bms = set([repo.changelog.rev(bin(r)) for r in listbookmarks(repo).values()])
return [r for r in subset if r in bms]
示例15: revset_reviewer
def revset_reviewer(repo, subset, x):
"""``reviewer(REVIEWER)``
Changesets reviewed by a specific person.
"""
l = revset.getargs(x, 1, 1, 'reviewer requires one argument')
n = encoding.lower(revset.getstring(l[0], 'reviewer requires a string'))
# Do not use a matcher here because regular expressions are not safe
# for remote execution and may DoS the server.
def hasreviewer(r):
for reviewer in commitparser.parse_reviewers(repo[r].description()):
if encoding.lower(reviewer) == n:
return True
return False
return subset.filter(hasreviewer)