本文整理汇总了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
示例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"
示例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
示例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