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


Python RepositoryManager.split方法代码示例

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


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

示例1: changeset_added

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import split [as 别名]
    def changeset_added(self, repos, changeset):
        newchange = changeset
        repo = RepositoryManager(self.env).repository_dir
        repdir = repo.split('.git')[0]
        changes = list(newchange.get_changes())
        print '....handling wikipages.......'
        for change in changes:
            directory = change[0].split('/')[0]
            filename = change[0].split('/')[1]
            pagename = filename.split('.txt')[0]
            extension = filename.split(pagename)[1]

            if (directory == 'wiki' and extension == '.txt'):
                path = repdir + change[0]

                if change[2] == 'edit' or change[2] == 'add':
                    self.add_wiki_file_to_trac(pagename, path)

                elif change[2] == 'delete':
                    self.delete_wiki_page_in_trac(pagename)
                    print (filename + ': wikipage removed.')

                else:
                    print 'Nothing todo.'
            else:
                print 'File was no textfile. Keep going.'
            print '....wikipage handling done......have a nice day :)!'
开发者ID:dhoess,项目名称:geekedit,代码行数:29,代码来源:geekedit.py

示例2: wiki_page_deleted

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import split [as 别名]
    def wiki_page_deleted(self, page):
        repo = RepositoryManager(self.env).repository_dir
        repdir = repo.split('.git')[0]

        os.chdir(repdir + "wiki/")

        subprocess.call(["git", "rm", repdir + "wiki/" + page.name + ".txt"])
        subprocess.call(["git", "commit", "-m", page.name + ".txt removed."])

        os.chdir(self.env.path)
开发者ID:dhoess,项目名称:geekedit,代码行数:12,代码来源:geekedit.py

示例3: wiki_page_added

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import split [as 别名]
    def wiki_page_added(self, page):
        repo = RepositoryManager(self.env).repository_dir
        repdir = repo.split('.git')[0]

        subprocess.call(["trac-admin", "", "wiki export", page.name, repdir + "wiki/" + "tmp.txt"])
        subprocess.call(["mv", repdir + "wiki/" + "tmp.txt", repdir + "wiki/" + page.name + ".txt"])
        os.chdir(repdir + "wiki/")

        subprocess.call(["git", "add", repdir + "wiki/" + page.name + ".txt"])
        subprocess.call(["git", "commit", "-m", page.name + ".txt added."])

        os.chdir(self.env.path)
开发者ID:dhoess,项目名称:geekedit,代码行数:14,代码来源:geekedit.py

示例4: process_request

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import split [as 别名]
    def process_request(self, req):
        global page_version
        repos = RepositoryManager(self.env).repository_dir
        repdir = repos.split('.git')[0]
        dirList = os.listdir(repdir + 'wiki')
        dirList.sort()
        count_do = 0
        count_no = 0

        for sFile in dirList:
            if sFile.find('.txt') == -1:
                continue
            try:
                filename = os.path.splitext(sFile)[0]
                if filename not in page_version:
                    page_version[filename] = 0
                content = read_file(repdir + 'wiki/' + sFile)
                page = WikiPage(self.env, filename)
                page.text = content.decode('unicode-escape')
                if page_version[filename] != page.version:
                    print (filename + ': local page version does not match online version!')
                    print ('Local version: ' + str(page_version[filename]) + ' <-> online version: ' + str(page.version) + '. Overwrite? (y/n)')
                    user_input = raw_input()
                    if user_input == 'y':
                        page.save(author='me', comment='', remote_addr='127.0.0.1')
                        count_do = count_do + 1
                        print (filename + ' created/modified as wiki page from version ' + str(page_version[filename]) + ' to version ' + str(page.version))
                        page_version[filename] = page.version
                    else:
                        print 'Page not created/modified'
                        count_no = count_no + 1
                        continue
                else:
                    page.save(author='me', comment='', remote_addr='127.0.0.1')
                    count_do = count_do + 1
                    print (filename + ' created/modified as wiki page from version ' + str(page_version[filename]) + ' to version ' + str(page.version))
                    page_version[filename] = page.version
            except:
                count_no = count_no + 1
                print (filename + ' not modified or changed; remained untouched')
                continue

        cont = str(count_do) + ' wiki pages created/modified and ' + str(count_no) + ' untouched'
        req.send_response(200)
        req.send_header('Content-Type', 'text/plain')
        req.send_header('Content-Length', len(cont))
        req.end_headers()
        req.write(cont)
开发者ID:dhoess,项目名称:geekedit,代码行数:50,代码来源:geekedit.py


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