如何递归到由PySVN.Client.list()返回的列表中?

如何递归到由PySVN.Client.list()返回的列表中?

问题描述:

我使用PySVN获取一些存储库信息。如何递归到由PySVN.Client.list()返回的列表中?

我用Client.listentries_list = client.list("https://myrepourl.com/myproject", ...)它“返回一个列表,给定路径中每个文件的信息元组。

我想从列表/元组中获取单个信息,这就是URL是否设置了一些属性(has_props - bool - 如果节点具有属性,则为true)。

如何递归到entries_list并返回远程http路径列表,但只有那些路径has_props设置为True

编辑:

entries_list {list} 
    000 {tuple} 
    0 {instance} 
     data {dict} 
     'path' = https://myrepourl.com/myproject/somedirorfile1 
     'has_props' = 1 
     'kind' = dir 
    001 {tuple} 
    0 {instance} 
     data {dict} 
     'path' = https://myrepourl.com/myproject/somedirorfile2 
     'has_props' = 1 
     'kind' = file 
    002 {tuple} 
    0 {instance} 
     data {dict} 
     'path' = https://myrepourl.com/myproject/somedirorfile3 
     'has_props' = 0 
     'kind' = dir 
. 
. 
. 
+1

你能发布一些entries_list的样本数据? – Mani

+0

这是如此复杂,我不能复制它! – Danijel

+0

只是发布列表中的第一个值 – Mani

这是has_props元素如何被访问:

has_props = entries_list[0][0][‘has_props’] 

这是如何循环并通过整个列表搜索:

entries_list = client.list("https://example.com/svnrepository/product",...) 

for entry in entries_list: 
    data_dict = entry[0] 
    has_props = data_dict['has_props'] 

    if has_props == 1: 
     print "Found props."