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


Python RepositoryManager.reload_repositories方法代码示例

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


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

示例1: add_repository

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import reload_repositories [as 别名]
    def add_repository(self, name):
        """Add a repository."""
        dir = os.path.join(self.parentpath, name)
        if not os.path.isabs(dir):
            raise TracError(_("The repository directory must be absolute"))
        trunk = os.path.join(dir, 'trunk')
        branches = os.path.join(dir, 'branches')
        tags = os.path.join(dir, 'tags')
        command = '"%(svnadmin)s" create "%(dir)s"; "%(svn)s" mkdir --parents -q -m "Created Folders" "file://%(trunk)s" "file://%(branches)s" "file://%(tags)s"' % {
            'svnadmin': self.admin,
            'dir': dir,
            'svn': self.client,
            'trunk': trunk,
            'branches': branches,
            'tags': tags
        }
        process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        (result, error) = process.communicate()
        if error is not None and error != "":
            if error.find('E165002') > -1:
                raise TracError(_('The repository "%(name)s" already exists.', name=name))
            elif error.find('E000002') > -1 or error.find('E000013') > -1:
                raise TracError(_("Can't create the repository '%(name)s.' "
                                  "Make sure the parent directory '%(parentpath)s' exists "
                                  "and the web server has write permissions for it.", name=name, parentpath=self.parentpath))
            else:
                raise TracError(error)
        if self.hookspath and os.path.exists(self.hookspath):
	        hooksdir = os.path.join(dir, 'hooks/')
	        files = os.listdir(self.hookspath)
	        files = [self.hookspath + '/' + filename for filename in files]
	        for file in files:
	        	shutil.copy2(file, hooksdir)
        rm = RepositoryManager(self.env)
        rm.reload_repositories()
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:37,代码来源:api.py

示例2: remove_repository

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import reload_repositories [as 别名]
 def remove_repository(self, name):
     """Remove a repository."""
     try:
         dir = os.path.join(self.parentpath, name)
         shutil.rmtree(dir)
         rm = RepositoryManager(self.env)
         rm.reload_repositories()
     except OSError, why:
         raise TracError(str(why))
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:11,代码来源:api.py

示例3: render_admin_panel

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

示例4: add_repository

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import reload_repositories [as 别名]
 def add_repository(self, name):
     """Add a repository."""
     dir = os.path.join(self.parentpath, name)
     if not os.path.isabs(dir):
         raise TracError(_("The repository directory must be absolute"))
     trunk = os.path.join(dir, 'trunk')
     branches = os.path.join(dir, 'branches')
     tags = os.path.join(dir, 'tags')
     command = u'"{svnadmin}" create "{dir}"'
     if self.create_base_structure:
         command += '; "{svn}" mkdir --parents -q -m "Created Folders" "file://{trunk}" "file://{branches}" "file://{tags}"'
     if self.chmod:
         command += '; chmod {chmod} "{dir}"'
     command = command.format(
         svnadmin=self.svnadmin,
         dir=dir,
         svn=self.svnclient,
         trunk=trunk,
         branches=branches,
         tags=tags,
         chmod=self.chmod,
     )
     process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     (result, error) = process.communicate()
     if error is not None and error != "":
         if error.find('E165002') > -1:
             raise TracError(_('The repository "%(name)s" already exists.', name=name))
         elif error.find('E000002') > -1 or error.find('E000013') > -1:
             raise TracError(_("Can't create the repository '%(name)s.' "
                               "Make sure the parent directory '%(parentpath)s' exists "
                               "and the web server has write permissions for it.", name=name, parentpath=self.parentpath))
         else:
             raise TracError(error)
     if self.hookspath and os.path.exists(self.hookspath):
         hooksdir = os.path.join(dir, 'hooks/')
         files = os.listdir(self.hookspath)
         files = [os.path.join(self.hookspath, filename) for filename in files]
         for f in files:
             shutil.copy2(f, hooksdir)
     rm = RepositoryManager(self.env)
     rm.reload_repositories()
开发者ID:lexqt,项目名称:EduTracSvnAdmin,代码行数:43,代码来源:api.py


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