• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python revset.getargs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mercurial.revset.getargs函数的典型用法代码示例。如果您正苦于以下问题:Python getargs函数的具体用法?Python getargs怎么用?Python getargs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getargs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]
开发者ID:Q2mber,项目名称:hg-git,代码行数:8,代码来源:__init__.py


示例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
开发者ID:armenzg,项目名称:version-control-tools,代码行数:8,代码来源:__init__.py


示例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)])
开发者ID:CSCI-362-02-2015,项目名称:RedTeam,代码行数:11,代码来源:rebase.py


示例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
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:33,代码来源:grepdiff.py


示例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]
开发者ID:CSRedRat,项目名称:hg-git,代码行数:7,代码来源:__init__.py


示例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])
开发者ID:atweiden,项目名称:dotfiles,代码行数:7,代码来源:hg_remotebranches.py


示例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")
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:29,代码来源:util.py


示例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())
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:18,代码来源:__init__.py


示例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)
开发者ID:charleseff,项目名称:dotfiles,代码行数:11,代码来源:hg_remotebranches.py


示例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)]
开发者ID:avuori,项目名称:dotfiles,代码行数:11,代码来源:util.py


示例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)
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:12,代码来源:gitrevset.py


示例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)]
开发者ID:CSRedRat,项目名称:hg-git,代码行数:14,代码来源:__init__.py


示例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())
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:16,代码来源:__init__.py


示例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]
开发者ID:ThissDJ,项目名称:designhub,代码行数:16,代码来源:bookmarks.py


示例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)
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:18,代码来源:__init__.py


示例16: 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")

    rev = repo.changelog.rev
    bin = node.bin
    meta = repo.svnmeta(skiperrorcheck=True)
    try:
        svnrevs = set(rev(bin(l.split(' ', 2)[1]))
                      for l in maps.RevMap.readmapfile(meta.revmap_file,
                                                       missingok=False))
        return filter(svnrevs.__contains__, subset)
    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,代码行数:19,代码来源:util.py


示例17: 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


示例18: 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


示例19: 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


示例20: pushed

def pushed(repo, subset, x):
    '''``pushed()``
    Select changesets in any remote repository according to remotebranches.
    '''
    args = revset.getargs(x, 0, 0, "pushed takes no arguments")
    return upstream_revs(lambda x: True, repo, subset, x)
开发者ID:atweiden,项目名称:dotfiles,代码行数:6,代码来源:hg_remotebranches.py



注:本文中的mercurial.revset.getargs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python revset.getstring函数代码示例发布时间:2022-05-27
下一篇:
Python revlog.hex函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap