3 # USAGE: dumprops.py [-r REV] repos-path [file]
5 # dump out the properties on a given path (recursively if given a dir)
12 my_getopt
= getopt
.gnu_getopt
13 except AttributeError:
14 my_getopt
= getopt
.getopt
17 from svn
import fs
, core
, repos
20 def dumpprops(path
, filename
='', rev
=None):
21 path
= core
.svn_path_canonicalize(path
)
22 repos_ptr
= repos
.open(path
)
23 fsob
= repos
.fs(repos_ptr
)
26 rev
= fs
.youngest_rev(fsob
)
28 root
= fs
.revision_root(fsob
, rev
)
29 print_props(root
, filename
)
30 if fs
.is_dir(root
, filename
):
31 walk_tree(root
, filename
)
33 def print_props(root
, path
):
34 raw_props
= fs
.node_proplist(root
, path
)
35 # need to massage some buffers into strings for printing
37 for key
, value
in raw_props
.items():
38 props
[key
] = str(value
)
43 def walk_tree(root
, path
):
44 for name
in fs
.dir_entries(root
, path
).keys():
45 full
= path
+ '/' + name
46 print_props(root
, full
)
47 if fs
.is_dir(root
, full
):
51 print "USAGE: dumpprops.py [-r REV] repos-path [file]"
55 opts
, args
= my_getopt(sys
.argv
[1:], 'r:')
57 for name
, value
in opts
:
61 dumpprops(args
[0], args
[1], rev
)
63 dumpprops(args
[0], "", rev
)
67 if __name__
== '__main__':