本文整理汇总了Python中mercurial.revset.getstring函数的典型用法代码示例。如果您正苦于以下问题:Python getstring函数的具体用法?Python getstring怎么用?Python getstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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")
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:29,代码来源:util.py
示例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())]
开发者ID:armenzg,项目名称:version-control-tools,代码行数:7,代码来源:__init__.py
示例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)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:12,代码来源:gitrevset.py
示例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)]
开发者ID:CSRedRat,项目名称:hg-git,代码行数:14,代码来源:__init__.py
示例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]
开发者ID:ThissDJ,项目名称:designhub,代码行数:16,代码来源:bookmarks.py
示例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())
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:16,代码来源:__init__.py
示例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())]
开发者ID:armenzg,项目名称:version-control-tools,代码行数:17,代码来源:__init__.py
示例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)
开发者ID:armenzg,项目名称:version-control-tools,代码行数:45,代码来源:__init__.py
示例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)
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:18,代码来源:__init__.py
示例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)
开发者ID:kilikkuo,项目名称:version-control-tools,代码行数:18,代码来源:__init__.py
示例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)
开发者ID:kilikkuo,项目名称:version-control-tools,代码行数:19,代码来源:__init__.py
示例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]
开发者ID:armenzg,项目名称:version-control-tools,代码行数:19,代码来源:__init__.py
示例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)
开发者ID:kilikkuo,项目名称:version-control-tools,代码行数:20,代码来源:__init__.py
示例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)]
开发者ID:avuori,项目名称:dotfiles,代码行数:20,代码来源:util.py
示例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
开发者ID:armenzg,项目名称:version-control-tools,代码行数:20,代码来源:__init__.py
示例16: 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)
revs = []
for rev in subset:
pushes = list(repo.changetracker.pushes_for_changeset(repo[rev].node()))
if not pushes:
continue
when = pushes[0][2]
if dm(when):
revs.append(rev)
return revs
开发者ID:armenzg,项目名称:version-control-tools,代码行数:21,代码来源:__init__.py
示例17: revset_pushuser
def revset_pushuser(repo, subset, x):
"""``pushuser(string)``
User name that pushed the changeset contains string. The match is
case-insensitive.
If `string` starts with `re:`, the remainder of the string is treated as
a regular expression. To match a user that actually contains `re:`, use
the prefix `literal:`.
"""
l = revset.getargs(x, 1, 1, 'pushuser requires one argument')
n = encoding.lower(revset.getstring(l[0], 'pushuser requires a string'))
kind, pattern, matcher = revset._substringmatcher(n)
def getrevs():
for pushid, who, when, nodes in repo.pushlog.pushes():
if matcher(encoding.lower(who)):
for node in nodes:
yield repo[node].rev()
return subset & revset.generatorset(getrevs())
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:21,代码来源:__init__.py
示例18: 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"))
reponame = repo.ui.config('fbconduit', 'reponame')
if not reponame:
# We don't know who we are, so we can't ask for a translation
return subset.filter(lambda r: False)
backingrepos = repo.ui.configlist('fbconduit', 'backingrepos',
default=[reponame])
lasterror = None
hghash = None
for backingrepo in backingrepos:
try:
result = call_conduit('scmquery.get.mirrored.revs',
from_repo=backingrepo,
from_scm='git',
to_repo=reponame,
to_scm='hg',
revs=[n]
)
hghash = result[n]
if hghash != '':
break
except Exception as ex:
lasterror = ex
if not hghash:
if lasterror:
repo.ui.warn(("Could not translate revision {0}: {1}\n".format(
n, lasterror)))
else:
repo.ui.warn(("Could not translate revision {0}\n".format(n)))
return subset.filter(lambda r: False)
rn = repo[node.bin(hghash)].rev()
return subset.filter(lambda r: r == rn)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:40,代码来源:fbconduit.py
示例19: 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)
heads = set(repo[r[4]].rev() for r in
repo.changetracker.tree_push_heads(tree))
return [r for r in subset if r in heads]
revs = []
for r in subset:
node = repo[r].node()
for push in repo.changetracker.pushes_for_changeset(node):
if str(push[4]) == node:
revs.append(r)
break
return revs
开发者ID:simar7,项目名称:git-version-control-tools-clone,代码行数:40,代码来源:__init__.py
示例20: filelogrevset
def filelogrevset(orig, repo, subset, x):
"""``filelog(pattern)``
Changesets connected to the specified filelog.
For performance reasons, ``filelog()`` does not show every changeset
that affects the requested file(s). See :hg:`help log` for details. For
a slower, more accurate result, use ``file()``.
"""
if not shallowrepo.requirement in repo.requirements:
return orig(repo, subset, x)
# i18n: "filelog" is a keyword
pat = revset.getstring(x, _("filelog requires a pattern"))
m = match.match(repo.root, repo.getcwd(), [pat], default='relpath',
ctx=repo[None])
s = set()
if not match.patkind(pat):
# slow
for r in subset:
ctx = repo[r]
cfiles = ctx.files()
for f in m.files():
if f in cfiles:
s.add(ctx.rev())
break
else:
# partial
for f in repo[None]:
filenode = m(f)
if filenode:
fctx = repo.filectx(f, fileid=filenode)
s.add(fctx.linkrev())
for actx in fctx.ancestors():
s.add(actx.linkrev())
return [r for r in subset if r in s]
开发者ID:pycontribs,项目名称:remotefilelog,代码行数:38,代码来源:__init__.py
注:本文中的mercurial.revset.getstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论