当前位置: 首页>>代码示例>>Python>>正文


Python SVN.info2方法代码示例

本文整理汇总了Python中RepSys.svn.SVN.info2方法的典型用法代码示例。如果您正苦于以下问题:Python SVN.info2方法的具体用法?Python SVN.info2怎么用?Python SVN.info2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RepSys.svn.SVN的用法示例。


在下文中一共展示了SVN.info2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_submit_info

# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import info2 [as 别名]
def get_submit_info(path):
    path = os.path.abspath(path)

    # First, look for SPECS and SOURCES directories.
    found = False
    while path != "/":
        if os.path.isdir(path):
            specsdir = os.path.join(path, "SPECS")
            sourcesdir = os.path.join(path, "SOURCES")
            if os.path.isdir(specsdir) and os.path.isdir(sourcesdir):
                found = True
                break
        path = os.path.dirname(path)
    if not found:
        raise Error, "SPECS and/or SOURCES directories not found"

    # Then, check if this is really a subversion directory.
    if not os.path.isdir(os.path.join(path, ".svn")):
        raise Error, "subversion directory not found"
    
    svn = SVN()

    # Now, extract the package name.
    info = svn.info2(path)
    url = info.get("URL")
    if url is None:
        raise Error, "missing URL from svn info %s" % path
    toks = url.split("/")
    if len(toks) < 2 or toks[-1] != "current":
        raise Error, "unexpected URL received from 'svn info'"
    name = toks[-2]
    url = "/".join(toks[:-1])

    # Finally, guess revision.
    max = -1
    files = []
    files.extend(glob.glob("%s/*" % specsdir))
    files.extend(glob.glob("%s/*" % sourcesdir))
    for file in files:
        try:
            info = svn.info2(file)
        except Error:
            # possibly not tracked
            continue
        if info is None:
            continue
        rawrev = info.get("Last Changed Rev")
        if rawrev:
            rev = int(rawrev)
            if rev > max:
                max = rev
    if max == -1:
        raise Error, "revision tag not found in 'svn info' output"

    if mirror.using_on(url):
        url = mirror.switchto_parent_url(url)
    
    return name, url, max
开发者ID:mdkcauldron,项目名称:proyvinds-repsys,代码行数:60,代码来源:rpmutil.py

示例2: commit

# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import info2 [as 别名]
def commit(target=".", message=None, logfile=None):
    svn = SVN()
    status = svn.status(target, quiet=True)
    if not status:
        print "nothing to commit"
        return
    info = svn.info2(target)
    url = info.get("URL")
    if url is None:
        raise Error, "working copy URL not provided by svn info"
    mirrored = mirror.using_on(url)
    if mirrored:
        newurl = mirror.switchto_parent(svn, url, target)
        print "relocated to", newurl
    # we can't use the svn object here because svn --non-interactive option
    # hides VISUAL
    opts = []
    if message is not None:
        opts.append("-m \"%s\"" % message)
    if logfile is not None:
        opts.append("-F \"%s\"" % logfile)
    mopts = " ".join(opts)
    os.system("svn ci %s %s" % (mopts, target))
    if mirrored:
        print "use \"repsys switch\" in order to switch back to mirror "\
                "later"
开发者ID:mdkcauldron,项目名称:proyvinds-repsys,代码行数:28,代码来源:rpmutil.py

示例3: switch

# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import info2 [as 别名]
def switch(mirrorurl=None):
    svn  = SVN()
    topdir = _getpkgtopdir()
    info = svn.info2(topdir)
    wcurl = info.get("URL")
    if wcurl is None:
        raise Error, "working copy URL not provided by svn info"
    newurl = mirror.autoswitch(svn, topdir, wcurl, mirrorurl)
    print "switched to", newurl
开发者ID:mdkcauldron,项目名称:proyvinds-repsys,代码行数:11,代码来源:rpmutil.py

示例4: rev_touched_url

# 需要导入模块: from RepSys.svn import SVN [as 别名]
# 或者: from RepSys.svn.SVN import info2 [as 别名]
def rev_touched_url(url, rev):
    svn = SVN()
    info = svn.info2(url)
    if info is None:
        raise Error, "can't fetch svn info about the URL: %s" % url
    root = info["Repository Root"]
    urlpath = url[len(root):]
    touched = False
    entries = svn.log(root, start=rev, limit=1)
    entry = entries[0]
    for change in entry.changed:
        path = change.get("path")
        if path and path.startswith(urlpath):
            touched = True
    return touched
开发者ID:mdkcauldron,项目名称:proyvinds-repsys,代码行数:17,代码来源:rpmutil.py


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