本文整理汇总了Python中trac.versioncontrol.RepositoryManager.get_youngest_rev方法的典型用法代码示例。如果您正苦于以下问题:Python RepositoryManager.get_youngest_rev方法的具体用法?Python RepositoryManager.get_youngest_rev怎么用?Python RepositoryManager.get_youngest_rev使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.versioncontrol.RepositoryManager
的用法示例。
在下文中一共展示了RepositoryManager.get_youngest_rev方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_admin_panel
# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_youngest_rev [as 别名]
def render_admin_panel(self, req, cat, page, path_info):
req.perm.require('SVNVERIFY_REPORT')
rm = RepositoryManager(self.env)
all_repos = rm.get_all_repositories()
db = self.env.get_read_db()
cursor = db.cursor()
if path_info:
# detailed
reponame = not is_default(path_info) and path_info or ''
info = all_repos.get(reponame)
if info is None:
raise TracError(_("Repository '%(repo)s' not found",
repo=path_info))
cursor.execute("SELECT type, time, result, log "
"FROM svnverify_log WHERE repository_id = %s "
"ORDER BY time DESC LIMIT 1",
(info['id'],))
row = cursor.fetchone()
if row:
info['check_type'] = row[0]
info['time_checked'] = format_datetime(from_utimestamp(row[1]))
info['pretty_status'] = int(row[2]) == 0 and "OK" or "Warning"
info['status'] = row[2]
info['log'] = row[3]
info['prettydir'] = breakable_path(info['dir'])
if info['name'] == '':
info['name'] = "(default)"
return 'svnverify.html', {"info": info}
else:
repositories = {}
for reponame, info in all_repos.iteritems():
if info.get('type',rm.repository_type) == "svn" or (rm.repository_type == 'svn' and info.get('type') == ''):
info['prettydir'] = breakable_path(info['dir'])
try:
r = RepositoryManager(self.env).get_repository(reponame)
info['rev'] = r.get_youngest_rev()
info['display_rev'] = r.display_rev(info['rev'])
except:
pass
cursor.execute("SELECT type, time, result "
"FROM svnverify_log "
"WHERE repository_id = %s "
"ORDER BY time DESC LIMIT 1",
(info['id'],))
row = cursor.fetchone()
if row:
info['check_type'] = row[0]
info['time_checked'] = format_datetime(from_utimestamp(row[1]))
info['pretty_status'] = int(row[2]) == 0 and "OK" or "Warning"
info['status'] = row[2]
repositories[reponame] = info
add_stylesheet(req, 'svnverify/css/svnverify.css')
return 'svnverifylist.html', {"repositories": repositories}
示例2: _extend_info
# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_youngest_rev [as 别名]
def _extend_info(self, reponame, info, editable):
"""Extend repository info for rendering."""
info['name'] = reponame
if info.get('dir') is not None:
info['prettydir'] = breakable_path(info['dir']) or ''
info['hidden'] = as_bool(info.get('hidden'))
info['editable'] = editable
if not info.get('alias'):
try:
repos = RepositoryManager(self.env).get_repository(reponame)
youngest_rev = repos.get_youngest_rev()
info['rev'] = youngest_rev
info['display_rev'] = repos.display_rev(youngest_rev)
except Exception:
pass
return info
示例3: _extend_info
# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_youngest_rev [as 别名]
def _extend_info(self, reponame, info, editable):
"""Extend repository info for rendering."""
info["name"] = reponame
if info.get("dir") is not None:
info["prettydir"] = breakable_path(info["dir"]) or ""
info["hidden"] = as_bool(info.get("hidden"))
info["editable"] = editable
if not info.get("alias"):
try:
repos = RepositoryManager(self.env).get_repository(reponame)
youngest_rev = repos.get_youngest_rev()
info["rev"] = youngest_rev
info["display_rev"] = repos.display_rev(youngest_rev)
except Exception:
pass
return info
示例4: _extend_info
# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_youngest_rev [as 别名]
def _extend_info(self, reponame, info, editable):
"""Extend repository info for rendering."""
info["name"] = reponame
info["hidden"] = as_bool(info.get("hidden"))
info["sync_per_request"] = as_bool(info.get("sync_per_request"))
info["editable"] = editable
if "alias" not in info:
if info.get("dir") is not None:
info["prettydir"] = breakable_path(info["dir"]) or ""
try:
repos = RepositoryManager(self.env).get_repository(reponame)
except InvalidRepository as e:
info["error"] = e
except TracError:
pass # Probably "unsupported connector"
else:
youngest_rev = repos.get_youngest_rev()
info["rev"] = youngest_rev
try:
info["display_rev"] = repos.display_rev(youngest_rev)
except NoSuchChangeset:
pass
return info