python - pysvn client.log() 返回空字典

标签 python pysvn

我有以下脚本用于从 svn 获取日志消息

import pysvn
class  svncheck(): 
    def __init__(self, svn_root="http://10.11.25.3/svn/Moodle/modules", svn_user=None, svn_password=None):
        self.user = svn_user
        self.password = svn_password
        self.root = svn_root

    def diffrence(self): 
        client = pysvn.Client()
        client.commit_info_style = 1
        client.callback_notify = self.notify
        client.callback_get_login = self.credentials
        log  = client.log(
        self.root, 
        revision_start=pysvn.Revision( pysvn.opt_revision_kind.number, 0),
        revision_end=pysvn.Revision( pysvn.opt_revision_kind.number, 5829),
        discover_changed_paths=True,
        strict_node_history=True,
        limit=0,
        include_merged_revisions=False,
        )
        print log
    def notify( event_dict ):
        print event_dict
        return   

    def credentials(realm, username, may_save):
           return True, self.user, self.password, True



s = svncheck()
s.diffrence()

当我运行这个脚本时,它返回一个空的字典对象 [<PysvnLog ''>, <PysvnLog ''>, <PysvnLog ''>,..

知道我在这里做错了什么吗? 我正在使用 pysvn 版本 1.7.2 再次构建 svn 版本 1.6.5 干杯 纳什

最佳答案

pysvn.Client.log 方法返回日志条目列表;每个日志条目都是一本字典。 (参见 pysvn Programmer's reference)

您可以像这样在代码中打印日志消息:

for info in log:
    print info.revision.number,
    print info.author,
    print time.ctime(info.date),
    print info.message

关于python - pysvn client.log() 返回空字典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2839386/

相关文章:

python - 如何模拟 pysvn

python - 在python中的字符串中插入多个元素

python - 使用 Python 3.4.1 和 Urllib3 访问 Imgur API

python - 为 Django 模型使用除 models.py 之外的其他文件名?

python - pysvn 可以在 Ubuntu 11.04 上使用 Python 3.2 吗?

python - pysvn-1.7.6 on rhel6,error : Not a URL, existing file, or requirement spec:

python - pysvn 基于日期导出

python - 如何在 Python 中拆分大型维基百科转储 .xml.bz2 文件?

python - 高效/优雅地将方法应用于对象的 numpy ndarray 或从中获取属性

Python:带有 [< >, <>...] 的列表