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


Python RepositoryManager.get_real_repositories方法代码示例

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


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

示例1: _get_authz_info

# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_real_repositories [as 别名]
 def _get_authz_info(self):
     try:
         mtime = os.path.getmtime(self.authz_file)
     except OSError as e:
         if self._authz is not None:
             self.log.error('Error accessing authz file: %s',
                            exception_to_unicode(e))
         self._mtime = mtime = 0
         self._authz = None
         self._users = set()
     if mtime != self._mtime:
         self._mtime = mtime
         rm = RepositoryManager(self.env)
         modules = set(repos.reponame
                       for repos in rm.get_real_repositories())
         if '' in modules and self.authz_module_name:
             modules.add(self.authz_module_name)
         modules.add('')
         self.log.info('Parsing authz file: %s', self.authz_file)
         try:
             self._authz = parse(read_file(self.authz_file), modules)
             self._users = set(user for paths in self._authz.itervalues()
                               for path in paths.itervalues()
                               for user, result in path.iteritems()
                               if result)
         except Exception as e:
             self._authz = None
             self._users = set()
             self.log.error('Error parsing authz file: %s',
                            exception_to_unicode(e))
     return self._authz, self._users
开发者ID:pkdevbox,项目名称:trac,代码行数:33,代码来源:svn_authz.py

示例2: post_process_request

# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_real_repositories [as 别名]
    def post_process_request(self, req, template, data, content_type):
        #add_script(req, 'multiproject/js/browser.js')
        repository_name = None
        data_repositories = None
        latest_revisions = []
        if len(req.path_info.split("/")) > 2:
            #Get repository name from path_info
            repository_name = req.path_info.split("/")[2]
        if template == 'browser.html':
            username = urllib.quote(req.authname)
            project = Project.get(self.env)
            schemes = None
            if repository_name:
                scm_type = repository_name + ".type"
                scm_dir = repository_name + ".dir"
                scm = self.env.config.get('repositories', scm_type)
                repository_name = self.env.config.get('repositories', scm_dir).split("/")[-1]
                schemes = self.protocols(project.id, scm)
                rm = RepositoryManager(self.env)
                list_repos = rm.get_real_repositories()
                for r in list_repos:
                    if r.get_base().split("/")[-1] == repository_name:
                        l_rev = r.get_youngest_rev()
                        if l_rev:
                            export_url = '../export/archive/'+repository_name+"?rev="+str(l_rev)+"&format=zip"
                            latest_revisions.append(export_url)

            else:
                scm = self.env.config.get('trac', 'repository_type')
                schemes = self.protocols(project.id, scm)
                data_repo_names = self.get_repositories()
                if len(data_repo_names) > 0:
                    data_repositories = []
                    for repo in data_repo_names:
                        type_scheme = []
                        for data_scheme in self.protocols(project.id, repo[1]):
                            type_scheme.append(self.create_co_command(repo[1], username, data_scheme, repo[0]))
                        data_repositories.append(type_scheme)

            

            names = {'git':'GIT', 'svn':'Subversion', 'hg':'Mercurial'}
            cmd_kinds = {'git':'Clone', 'hg':'Clone', 'svn':'Check out'}

            type = names[scm]
            

            data['kinds'] = cmd_kinds
            data['schemes'] = schemes
            data['name'] = names[scm]
            data['type'] = scm
            data['data_repositories'] = data_repositories
            data['export_urls'] = latest_revisions

            co_commands = {}
            for scheme in schemes:
                co_commands[scheme] = self.create_co_command(scm, username, scheme, repository_name)
            data['co_commands'] = co_commands

        return template, data, content_type
开发者ID:alvabai,项目名称:trac-multiproject,代码行数:62,代码来源:checkout.py

示例3: get_entries_for_index

# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_real_repositories [as 别名]
 def get_entries_for_index(self):
     repository_manager = RepositoryManager(self.env)
     for repository in repository_manager.get_real_repositories():
         rev = repository.oldest_rev
         stop = repository.youngest_rev
         while True:
             changeset = repository.get_changeset(rev)
             yield ChangesetIndexer(self.env).build_doc(changeset)
             if rev == stop:
                 break
             rev = repository.next_rev(rev)
开发者ID:ahorincar,项目名称:bloodhound_solr_plugin,代码行数:13,代码来源:changeset_search.py

示例4: sync

# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_real_repositories [as 别名]
    def sync(self, project):
        """Sync the trac environment with cydra
        
        This sets the options returned by ``get_default_options`` and adds Trac's own defaults if necessary"""
        if not self.has_env(project):
            logger.warning('Project %s has no Trac Environment to sync', project.name)
            return

        tracini = os.path.join(self.get_env_path(project), 'conf', 'trac.ini')
        options = self.get_default_options(project)

        # if inherit is enabled, the default values are supposed to be in
        # the inherited file. Thus, we can truncate the config file to get a bare minimum
        if 'inherit_config' in self.component_config:
            options.append(('inherit', 'file', self.component_config['inherit_config']))
            with open(tracini, 'w') as f:
                f.truncate()

        # re-create the configuration file
        config = Configuration(tracini)
        for section, name, value in options:
            config.set(section, name, value)
        config.save()

        # load defaults
        if not any((section, option) == ('inherit', 'file') for section, option, value in options):
            config.set_defaults()
            config.save()

        # check if repositories in cydra match repositories in trac
        env = Environment(self.get_env_path(project))
        rm = RepositoryManager(env)
        trac_repos = rm.get_real_repositories()
        trac_repo_names = [r.reponame for r in trac_repos]

        for repotype, repos in project.data.get('plugins', {}).get('trac', {}).items():
            for repo, tracname in (repos or {}).items():
                if tracname not in trac_repo_names:
                    logger.warning("Removing trac mapping from cydra for %s repo %s", repo, tracname)
                    del repos[repo]
                    if not repos:
                        del project.data.get('plugins', {}).get('trac', {})[repotype]

        # Now do the reverse
        revmap = dict([(y, x) for (x, y) in self.typemap.items()])

        for repo in trac_repos:
            logger.debug('Looking at trac repo %s', repo.reponame)

            try:
                baseparts = repo.get_base().split(':') # This is extremely naiive and possibly breaks some time
                repotype, path = baseparts[0], baseparts[-1]
            except:
                logger.error("Unable to parse: " + repo.get_base())

            reponame = os.path.basename(path)
            if repotype == 'git':
                reponame = reponame[:-4]

            try:
                repository = project.get_repository(revmap[repotype], reponame)
            except:
                logger.error("Unable to locate %s %s (%s)", repotype, reponame, path)
                repository = None

            logger.debug('Cydra repo %r', repository)

            if repository:
                # set this mapping if not there already
                project.data.setdefault('plugins', {}).setdefault('trac', {}).setdefault(repository.type, {})[repository.name] = repo.reponame
                logger.info('Setting trac mapping for %s %s -> %s', repository.type, repository.name, repo.reponame)
            else:
                logger.error("Unable to load %s %s (%s)", revmap[repotype], reponame, path)

        project.save()
开发者ID:akuendig,项目名称:cydra,代码行数:77,代码来源:__init__.py

示例5: get_navigation_items

# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_real_repositories [as 别名]
 def get_navigation_items(self, req):
     rm = RepositoryManager(self.env)
     if 'BROWSER_VIEW' in req.perm and rm.get_real_repositories():
         yield ('mainnav', 'browser',
                tag.a(_('Browse Source'), href=req.href.browser()))
开发者ID:zjj,项目名称:trac_hack,代码行数:7,代码来源:browser.py

示例6: get_navigation_items

# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_real_repositories [as 别名]
 def get_navigation_items(self, req):
     rm = RepositoryManager(self.env)
     if any(repos.is_viewable(req.perm) for repos in rm.get_real_repositories()):
         yield ("mainnav", "browser", tag.a(_("Browse Source"), href=req.href.browser()))
开发者ID:pkdevbox,项目名称:trac,代码行数:6,代码来源:browser.py


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