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


Python RepositoryManager.get_all_repositories方法代码示例

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


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

示例1: __init__

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
 def __init__(self):
     # Retrieve info for all repositories associated with this project
     self.authz_file = self.config.get('trac', 'authz_file')
     rm = RepositoryManager(self.env)
     all_repos = rm.get_all_repositories()
     for (reponame, info) in all_repos.iteritems():
         self.project_repos.append(reponame)
     self.env.log.debug("SvnAuthzAdminPlugin: project_repos: '%s'" % self.project_repos)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:10,代码来源:admin_ui.py

示例2: render_admin_panel

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [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

示例3: _do_list

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
 def _do_list(self):
     rm = RepositoryManager(self.env)
     values = []
     for (reponame, info) in sorted(rm.get_all_repositories().iteritems()):
         alias = ""
         if "alias" in info:
             alias = info["alias"] or "(default)"
         values.append((reponame or "(default)", info.get("type", ""), alias, info.get("dir", "")))
     print_table(values, [_("Name"), _("Type"), _("Alias"), _("Directory")])
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:11,代码来源:admin.py

示例4: _do_list

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
 def _do_list(self):
     rm = RepositoryManager(self.env)
     values = []
     for (reponame, info) in sorted(rm.get_all_repositories().iteritems()):
         alias = ''
         if 'alias' in info:
             alias = info['alias'] or '(default)'
         values.append((reponame or '(default)', info.get('type', ''),
                        alias, info.get('dir', '')))
     print_table(values, [_('Name'), _('Type'), _('Alias'), _('Directory')])
开发者ID:zjj,项目名称:trac_hack,代码行数:12,代码来源:admin.py

示例5: render_admin_panel

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
    def render_admin_panel(self, req, category, page, path_info):
        if not isinstance(self.env, ProductEnvironment):
            return super(ProductRepositoryAdminPanel, self).render_admin_panel(
                req, category, page, path_info)

        req.perm.require('VERSIONCONTROL_ADMIN')
        db_provider = self.env[DbRepositoryProvider]

        if req.method == 'POST' and db_provider:
            if req.args.get('remove'):
                repolist = req.args.get('sel')
                if repolist:
                    if isinstance(repolist, basestring):
                        repolist = [repolist, ]
                    for reponame in repolist:
                        db_provider.unlink_product(reponame)
            elif req.args.get('addlink') is not None and db_provider:
                reponame = req.args.get('repository')
                db_provider.link_product(reponame)
            req.redirect(req.href.admin(category, page))

        # Retrieve info for all product repositories
        rm_product = RepositoryManager(self.env)
        rm_product.reload_repositories()
        all_product_repos = rm_product.get_all_repositories()
        repositories = dict((reponame, self._extend_info(
                                reponame, info.copy(), True))
                            for (reponame, info) in
                                all_product_repos.iteritems())
        types = sorted([''] + rm_product.get_supported_types())

        # construct a list of all repositores not linked to this product
        rm = RepositoryManager(self.env.parent)
        all_repos = rm.get_all_repositories()
        unlinked_repositories = dict([(k, all_repos[k]) for k in
            sorted(set(all_repos) - set(all_product_repos))])

        data = {'types': types, 'default_type': rm_product.repository_type,
                'repositories': repositories,
                'unlinked_repositories': unlinked_repositories}
        return 'repository_links.html', data
开发者ID:mohsadki,项目名称:dargest,代码行数:43,代码来源:product_admin.py

示例6: getStatus

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
 def getStatus(self, req):
     """Get overall status from the last time verification was performed."""
     db = self.env.get_read_db()
     cursor = db.cursor()
     rm = RepositoryManager(self.env)
     for reponame, info in rm.get_all_repositories().iteritems():
         if info.get('type',rm.repository_type) == "svn" or (rm.repository_type == 'svn' and info.get('type') == ''):
             self.log.debug("Checking database for status of %s", info)
             cursor.execute("SELECT result FROM svnverify_log "
                            "WHERE repository_id = %s "
                            "ORDER BY time DESC LIMIT 1",
                            (info['id'],))
             row = cursor.fetchone()
             if row and row[0] != 0:
                 return False
     return True
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-svnverify,代码行数:18,代码来源:commands.py

示例7: verifyAll

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
 def verifyAll(self):
     all_verified_good = True
     rm = RepositoryManager(self.env)
     for reponame, info in rm.get_all_repositories().iteritems():
         self.log.debug("Considering %s", info)
         if info.get('type',rm.repository_type) == "svn" or (rm.repository_type == 'svn' and info.get('type') == ''):
             if self.number_of_commits_to_verify < 0:
                 bound = 0
             elif self.number_of_commits_to_verify == 0:
                 self.log.warning("Not actually verifying any commits due to [svn]verify_n_commits = 0")
                 return 0
             else:
                 y = rm.get_repository(reponame).youngest_rev
                 bound = max(0, y - self.number_of_commits_to_verify + 1)
                 self.log.debug("Only want to verify %d commits, so range is %d:HEAD (HEAD is currently %d)", 
                                self.number_of_commits_to_verify,
                                bound,
                                y)
             if not self.verify(info['id'], info['dir'], start=bound):
                     all_verified_good = False
     if not all_verified_good:
         return 1
     else:
         return 0
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-svnverify,代码行数:26,代码来源:commands.py

示例8: get_reponames

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
 def get_reponames(self):
     rm = RepositoryManager(self.env)
     return [reponame or '(default)' for reponame
             in rm.get_all_repositories()]
开发者ID:zjj,项目名称:trac_hack,代码行数:6,代码来源:admin.py

示例9: render_admin_panel

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
    def render_admin_panel(self, req, category, page, path_info):
        req.perm.require('VERSIONCONTROL_ADMIN')
        
        # Retrieve info for all repositories
        rm = RepositoryManager(self.env)
        all_repos = rm.get_all_repositories()
        db_provider = self.env[DbRepositoryProvider]
        
        if path_info:
            # Detail view
            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))
            if req.method == 'POST':
                if req.args.get('cancel'):
                    req.redirect(req.href.admin(category, page))
                
                elif db_provider and req.args.get('save'):
                    # Modify repository
                    changes = {}
                    for field in db_provider.repository_attrs:
                        value = normalize_whitespace(req.args.get(field))
                        if (value is not None or field == 'hidden') \
                                and value != info.get(field):
                            changes[field] = value
                    if 'dir' in changes \
                            and not self._check_dir(req, changes['dir']):
                        changes = {}
                    if changes:
                        db_provider.modify_repository(reponame, changes)
                        add_notice(req, _('Your changes have been saved.'))
                    name = req.args.get('name')
                    resync = tag.tt('trac-admin $ENV repository resync "%s"'
                                    % (name or '(default)'))
                    if 'dir' in changes:
                        msg = tag_('You should now run %(resync)s to '
                                   'synchronize Trac with the repository.',
                                   resync=resync)
                        add_notice(req, msg)
                    elif 'type' in changes:
                        msg = tag_('You may have to run %(resync)s to '
                                   'synchronize Trac with the repository.',
                                   resync=resync)
                        add_notice(req, msg)
                    if name and name != path_info and not 'alias' in info:
                        cset_added = tag.tt('trac-admin $ENV changeset '
                                            'added "%s" $REV'
                                            % (name or '(default)'))
                        msg = tag_('You will need to update your post-commit '
                                   'hook to call %(cset_added)s with the new '
                                   'repository name.', cset_added=cset_added)
                        add_notice(req, msg)
                    if changes:
                        req.redirect(req.href.admin(category, page))
            
            Chrome(self.env).add_wiki_toolbars(req)
            data = {'view': 'detail', 'reponame': reponame}
        
        else:
            # List view
            if req.method == 'POST':
                # Add a repository
                if db_provider and req.args.get('add_repos'):
                    name = req.args.get('name')
                    type_ = req.args.get('type')
                    # Avoid errors when copy/pasting paths
                    dir = normalize_whitespace(req.args.get('dir', ''))
                    if name is None or type_ is None or not dir:
                        add_warning(req, _('Missing arguments to add a '
                                           'repository.'))
                    elif self._check_dir(req, dir):
                        db_provider.add_repository(name, dir, type_)
                        name = name or '(default)'
                        add_notice(req, _('The repository "%(name)s" has been '
                                          'added.', name=name))
                        resync = tag.tt('trac-admin $ENV repository resync '
                                        '"%s"' % name)
                        msg = tag_('You should now run %(resync)s to '
                                   'synchronize Trac with the repository.',
                                   resync=resync)
                        add_notice(req, msg)
                        cset_added = tag.tt('trac-admin $ENV changeset '
                                            'added "%s" $REV' % name)
                        msg = tag_('You should also set up a post-commit hook '
                                   'on the repository to call %(cset_added)s '
                                   'for each committed changeset.',
                                   cset_added=cset_added)
                        add_notice(req, msg)
                        req.redirect(req.href.admin(category, page))
                
                # Add a repository alias
                elif db_provider and req.args.get('add_alias'):
                    name = req.args.get('name')
                    alias = req.args.get('alias')
                    if name is not None and alias is not None:
                        db_provider.add_alias(name, alias)
                        add_notice(req, _('The alias "%(name)s" has been '
                                          'added.', name=name or '(default)'))
#.........这里部分代码省略.........
开发者ID:zjj,项目名称:trac_hack,代码行数:103,代码来源:admin.py

示例10: render_admin_panel

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import get_all_repositories [as 别名]
    def render_admin_panel(self, req, category, page, path_info):
        req.perm.require("VERSIONCONTROL_ADMIN")

        # Retrieve info for all repositories
        rm = RepositoryManager(self.env)
        all_repos = rm.get_all_repositories()
        db_provider = self.env[DbRepositoryProvider]

        if path_info:
            # Detail view
            reponame = path_info if not is_default(path_info) else ""
            info = all_repos.get(reponame)
            if info is None:
                raise TracError(_("Repository '%(repo)s' not found", repo=path_info))
            if req.method == "POST":
                if req.args.get("cancel"):
                    req.redirect(req.href.admin(category, page))

                elif db_provider and req.args.get("save"):
                    # Modify repository
                    changes = {}
                    for field in db_provider.repository_attrs:
                        value = normalize_whitespace(req.args.get(field))
                        if (value is not None or field == "hidden") and value != info.get(field):
                            changes[field] = value
                    if "dir" in changes and not self._check_dir(req, changes["dir"]):
                        changes = {}
                    if changes:
                        db_provider.modify_repository(reponame, changes)
                        add_notice(req, _("Your changes have been saved."))
                    name = req.args.get("name")
                    resync = tag.tt('trac-admin $ENV repository resync "%s"' % (name or "(default)"))
                    if "dir" in changes:
                        msg = tag_(
                            "You should now run %(resync)s to " "synchronize Trac with the repository.", resync=resync
                        )
                        add_notice(req, msg)
                    elif "type" in changes:
                        msg = tag_(
                            "You may have to run %(resync)s to " "synchronize Trac with the repository.", resync=resync
                        )
                        add_notice(req, msg)
                    if name and name != path_info and not "alias" in info:
                        cset_added = tag.tt("trac-admin $ENV changeset " 'added "%s" $REV' % (name or "(default)"))
                        msg = tag_(
                            "You will need to update your post-commit "
                            "hook to call %(cset_added)s with the new "
                            "repository name.",
                            cset_added=cset_added,
                        )
                        add_notice(req, msg)
                    if changes:
                        req.redirect(req.href.admin(category, page))

            Chrome(self.env).add_wiki_toolbars(req)
            data = {"view": "detail", "reponame": reponame}

        else:
            # List view
            if req.method == "POST":
                # Add a repository
                if db_provider and req.args.get("add_repos"):
                    name = req.args.get("name")
                    type_ = req.args.get("type")
                    # Avoid errors when copy/pasting paths
                    dir = normalize_whitespace(req.args.get("dir", ""))
                    if name is None or type_ is None or not dir:
                        add_warning(req, _("Missing arguments to add a " "repository."))
                    elif self._check_dir(req, dir):
                        db_provider.add_repository(name, dir, type_)
                        name = name or "(default)"
                        add_notice(req, _('The repository "%(name)s" has been ' "added.", name=name))
                        resync = tag.tt("trac-admin $ENV repository resync " '"%s"' % name)
                        msg = tag_(
                            "You should now run %(resync)s to " "synchronize Trac with the repository.", resync=resync
                        )
                        add_notice(req, msg)
                        cset_added = tag.tt("trac-admin $ENV changeset " 'added "%s" $REV' % name)
                        msg = tag_(
                            "You should also set up a post-commit hook "
                            "on the repository to call %(cset_added)s "
                            "for each committed changeset.",
                            cset_added=cset_added,
                        )
                        add_notice(req, msg)
                        req.redirect(req.href.admin(category, page))

                # Add a repository alias
                elif db_provider and req.args.get("add_alias"):
                    name = req.args.get("name")
                    alias = req.args.get("alias")
                    if name is not None and alias is not None:
                        db_provider.add_alias(name, alias)
                        add_notice(req, _('The alias "%(name)s" has been ' "added.", name=name or "(default)"))
                        req.redirect(req.href.admin(category, page))
                    add_warning(req, _("Missing arguments to add an " "alias."))

                # Refresh the list of repositories
                elif req.args.get("refresh"):
                    req.redirect(req.href.admin(category, page))
#.........这里部分代码省略.........
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:103,代码来源:admin.py


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