如何在SVN存储库中找到创建分支的修订?

2024-05-15 07:56:46 发布

您现在位置:Python中文网/ 问答频道 /正文

在给定的SVN存储库中,我试图编写一个脚本来查找创建分支的修订。在TortoiseSVN修订图中,您可以很容易地找到它们,所以我想这是可能的。在

到目前为止,我几乎可以通过解析xml格式的完整详细日志(svn log -v --xml)和过滤logentry节点(Python with minidom模块)来完成:

liste_revision = [item for item in doc.getElementsByTagName('logentry')
if (item.getElementsByTagName('path').length==1 and
item.getElementsByTagName('path')[0].getAttribute('kind')=="dir" and
item.getElementsByTagName('path')[0].getAttribute('action')=="A" and
"/branches/" in item.getElementsByTagName('path')[0].firstChild.nodeValue)]

我说这几乎是因为有一两件不需要的东西仍然会通过这些过滤器。这个算法也很重,因为我要过滤整个日志。在

所以我的问题是:

  • 是否存在直接过滤的svn log命令?我听说过svn log --stop-on-copy,但它似乎只适用于当前分支。在
  • 你觉得有更好的过滤器吗?我是从我的存储库中的示例中创建的。在
  • (子公司)我认为创建分支意味着修订是对的吗?在

Tags: andpathin脚本log过滤器分支svn