12 sys
.stderr
.write('Usage: %s OPTION [DIRECTORY]\n\n' % os
.path
.basename(cmd
))
14 'Show the contents of the temporary database files created by cvs2svn\n'
15 'in a structured human-readable way.\n'
18 ' -s SymbolicNameTracker state database\n'
19 ' -R RepositoryMirror revisions table\n'
20 ' -N RepositoryMirror nodes table\n'
21 ' -y RepositoryMirror symroots table\n'
22 ' -r rev RepositoryMirror node tree for specific revision\n'
24 'DIRECTORY is the directory containing the temporary database files.\n'
25 'If omitted, the current directory is assumed.\n')
29 def print_node_tree(db
, key
="0", name
="<rootnode>", prefix
=""):
30 print "%s%s (%s)" % (prefix
, name
, key
)
32 dict = marshal
.loads(db
[key
])
36 print_node_tree(db
, entry
[1], entry
[0], prefix
+ " ")
41 opts
, args
= getopt
.getopt(sys
.argv
[1:], "sRNyr:")
42 except getopt
.GetoptError
:
45 if len(args
) > 1 or len(opts
) != 1:
55 db
= anydbm
.open("cvs2svn-sym-names.db", 'r')
56 print "SymbolicNameTracker state database"
59 db
= anydbm
.open("cvs2svn-revisions.db", 'r')
60 print "RepositoryMirror revisions table"
61 k
= map(lambda x
: int(x
), db
.keys())
64 print "%6d: %s" % (i
, db
[str(i
)])
66 db
= anydbm
.open("cvs2svn-nodes.db", 'r')
67 print "RepositoryMirror nodes table"
71 print "%6s: %s" % (i
, marshal
.loads(db
[i
]))
73 db
= anydbm
.open("cvs2svn-symroots.db", 'r')
74 print "RepositoryMirror symroots table"
78 print "%s: %s" % (i
, marshal
.loads(db
[i
]))
83 sys
.stderr
.write('Option -r requires a valid revision number\n')
85 db
= anydbm
.open("cvs2svn-revisions.db", 'r')
86 key
= marshal
.loads(db
[str(revnum
)])
88 db
= anydbm
.open("cvs2svn-nodes.db", 'r')
89 print_node_tree(db
, key
, "Revision %d" % revnum
)
97 if __name__
== '__main__':