本文整理汇总了Python中mercurial.revset.getstring函数的典型用法代码示例。如果您正苦于以下问题:Python getstring函数的具体用法?Python getstring怎么用?Python getstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getstring函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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")
示例2: revset_reviewer
def revset_reviewer(repo, subset, x):
"""``reviewer(REVIEWER)``
Changesets reviewed by a specific person.
"""
n = revset.getstring(x, _('reviewer() requires a string argument.'))
return [r for r in subset if n in parse_reviewers(repo[r].description())]
示例3: 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)
示例4: 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)]
示例5: 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]
示例6: 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())
示例7: revset_bug
def revset_bug(repo, subset, x):
"""``bug(N)```
Changesets referencing a specified Bugzilla bug. e.g. bug(123456).
"""
err = _('bug() requires an integer argument.')
bugstring = revset.getstring(x, err)
try:
bug = int(bugstring)
except Exception:
raise ParseError(err)
# We do a simple string test first because avoiding regular expressions
# is good for performance.
return [r for r in subset
if bugstring in repo[r].description() and
bug in parse_bugs(repo[r].description())]
示例8: revset_pushhead
def revset_pushhead(repo, subset, x):
"""``pushhead([TREE])``
Changesets that are push heads.
A push head is a changeset that was a head when it was pushed to a
repository. In other words, the automation infrastructure likely
kicked off a build using this changeset.
If an argument is given, we limit ourselves to pushes on the specified
tree.
If no argument is given, we return all push heads for all trees. Note that
a changeset can be a push head multiple times. This function doesn't care
where the push was made if no argument was given.
"""
# We have separate code paths because the single tree path uses a single
# query and is faster.
if x:
tree = revset.getstring(x, _('pushhead() requires a string argument.'))
tree, uri = resolve_trees_to_uris([tree])[0]
if not uri:
raise util.Abort(_("Don't know about tree: %s") % tree)
def pushheads():
for push_id, head_changeset in repo.changetracker.tree_push_head_changesets(tree):
try:
head = repo[head_changeset].rev()
yield head
except error.RepoLookupError:
# There are some malformed pushes. Ignore them.
continue
# Push heads are returned in order of ascending push ID, which
# corresponds to ascending commit order in hg.
return subset & revset.generatorset(pushheads(), iterasc=True)
else:
def is_pushhead(r):
node = repo[r].node()
for push in repo.changetracker.pushes_for_changeset(node):
if str(push[4]) == node:
return True
return False
return subset.filter(is_pushhead)
示例9: 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)
示例10: revset_firstpushdate
def revset_firstpushdate(repo, subset, x):
"""``firstpushdate(DATE)``
Changesets that were initially pushed according to the date spec provided.
"""
ds = revset.getstring(x, _('firstpushdate() requires a string'))
dm = util.matchdate(ds)
def fltr(x):
pushes = list(repo.changetracker.pushes_for_changeset(repo[x].node()))
if not pushes:
return False
when = pushes[0][2]
return dm(when)
return subset.filter(fltr)
示例11: revset_pushdate
def revset_pushdate(repo, subset, x):
"""``pushdate(DATE)``
Changesets that were pushed according to the date spec provided.
All pushes are examined.
"""
ds = revset.getstring(x, _('pushdate() requires a string'))
dm = util.matchdate(ds)
def fltr(x):
for push in repo.changetracker.pushes_for_changeset(repo[x].node()):
when = push[2]
if dm(when):
return True
return False
return subset.filter(fltr)
示例12: revset_tree
def revset_tree(repo, subset, x):
"""``tree(X)``
Changesets currently in the specified Mozilla tree.
A tree is the name of a repository. e.g. ``central``.
"""
err = _('tree() requires a string argument.')
tree = revset.getstring(x, err)
tree, uri = resolve_trees_to_uris([tree])[0]
if not uri:
raise util.Abort(_("Don't know about tree: %s") % tree)
ref = '%s/default' % tree
head = repo[ref].rev()
ancestors = set(repo.changelog.ancestors([head], inclusive=True))
return [r for r in subset if r in ancestors]
示例13: revset_firstpushtree
def revset_firstpushtree(repo, subset, x):
"""``firstpushtree(X)``
Changesets that were initially pushed to tree X.
"""
tree = revset.getstring(x, _('firstpushtree() requires a string argument.'))
tree, uri = resolve_trees_to_uris([tree])[0]
if not uri:
raise util.Abort(_("Don't know about tree: %s") % tree)
def fltr(x):
pushes = list(repo.changetracker.pushes_for_changeset(
repo[x].node()))
if not pushes:
return False
return pushes[0][0] == tree
return subset.filter(fltr)
示例14: 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:
rev = int(rev)
except ValueError:
raise error.ParseError("the argument to svnrev() must be a number")
def matches(r):
convertinfo = repo[r].extra().get('convert_revision', '')
if convertinfo[:4] != 'svn:':
return False
return int(convertinfo[40:].rsplit('@', 1)[-1]) == rev
return [r for r in subset if matches(r)]
示例15: revset_pushdate
def revset_pushdate(repo, subset, x):
"""``pushdate(DATE)``
Changesets that were pushed according to the date spec provided.
All pushes are examined.
"""
ds = revset.getstring(x, _('pushdate() requires a string'))
dm = util.matchdate(ds)
revs = []
for rev in subset:
for push in repo.changetracker.pushes_for_changeset(repo[rev].node()):
when = push[2]
if dm(when):
revs.append(rev)
break
return revs