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


Python RepositoryManager.display_rev方法代码示例

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


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

示例1: render_admin_panel

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import display_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}
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-svnverify,代码行数:60,代码来源:web_ui.py

示例2: _extend_info

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import display_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
开发者ID:zjj,项目名称:trac_hack,代码行数:18,代码来源:admin.py

示例3: _extend_info

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import display_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
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:18,代码来源:admin.py

示例4: _extend_info

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import display_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
开发者ID:pkdevbox,项目名称:trac,代码行数:25,代码来源:admin.py


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