3 # Print a description (including data, path, and revision) of the
4 # specified node reps in a Subversion filesystem. Walks as much of
5 # the reps table as necessary to locate the data (e.g. does a table
9 import sys
, os
, re
, codecs
11 # Local support modules
15 progname
= os
.path
.basename(sys
.argv
[0])
16 if len(sys
.argv
) >= 3:
17 dbhome
= os
.path
.join(sys
.argv
[1], 'db')
18 if not os
.path
.exists(dbhome
):
19 sys
.stderr
.write("%s: '%s' is not a valid svn repository\n" %
20 (sys
.argv
[0], dbhome
))
22 rep_ids
= sys
.argv
[2:]
24 print >> sys
.stderr
, "Usage: %s <svn-repository> <rep-id>..." % progname
27 print "%s running on repository '%s'" % (progname
, dbhome
)
29 rep_ids
= dict.fromkeys(rep_ids
)
30 ctx
= svnfs
.Ctx(dbhome
)
32 cur
= ctx
.nodes_db
.cursor()
36 if rec
[0] != 'next-key':
37 nid
, cid
, tid
= rec
[0].split(".")
38 nd
= skel
.Node(rec
[1])
39 if nd
.datarep
in rep_ids
:
40 rev
= skel
.Txn(ctx
.txns_db
[tid
]).rev
41 print "%s: data of '%s%s' in r%s" % (nd
.datarep
,
42 nd
.createpath
, {"dir":'/', "file":''}[nd
.kind
], rev
)
43 if nd
.proprep
in rep_ids
:
44 rev
= skel
.Txn(ctx
.txns_db
[tid
]).rev
45 print "%s: properties of '%s%s' in r%s" % (nd
.datarep
,
46 nd
.createpath
, {"dir":'/', "file":''}[nd
.kind
], rev
)
53 if __name__
== '__main__':