2 # ====================================================================
3 # Copyright (c) 2000-2004 CollabNet. All rights reserved.
5 # This software is licensed as described in the file COPYING, which
6 # you should have received as part of this distribution. The terms
7 # are also available at http://subversion.tigris.org/license-1.html.
8 # If newer versions of this license are posted there, you may use a
9 # newer version instead, at your option.
11 # This software consists of voluntary contributions made by many
12 # individuals. For exact contribution history, see the revision
13 # history and logs, available at http://cvs2svn.tigris.org/.
14 # ====================================================================
18 Report information about CVS revisions, tags, and branches in a CVS
19 repository by examining the temporary files output by pass 1 of cvs2svn
20 on that repository. NOTE: You have to run the conversion pass yourself!
23 import sys
, os
, os
.path
25 from cvs2svn_lib
.database
import DB_OPEN_READ
26 from cvs2svn_lib
.config
import CVS_FILES_DB
, CVS_REVS_DB
, ALL_REVS_DATAFILE
27 from cvs2svn_lib
.cvs_file_database
import CVSFileDatabase
28 from cvs2svn_lib
.cvs_revision_database
import CVSRevisionDatabase
31 cvs_files_db
= CVSFileDatabase(CVS_FILES_DB
, DB_OPEN_READ
)
32 cvs_revs_db
= CVSRevisionDatabase(cvs_files_db
, CVS_REVS_DB
, DB_OPEN_READ
)
33 fp
= open(ALL_REVS_DATAFILE
, 'r')
45 line_count
= line_count
+ 1
50 c_rev_key
= line
.strip()
51 c_rev
= cvs_revs_db
.get_revision(c_rev_key
)
54 num_tags
= len(c_rev
.tags
)
55 max_tags
= (num_tags
> max_tags
) \
56 and num_tags
or max_tags
57 total_tags
= total_tags
+ num_tags
58 for tag
in c_rev
.tags
:
62 num_branches
= len(c_rev
.branches
)
63 max_branches
= (num_branches
> max_branches
) \
64 and num_branches
or max_branches
65 total_branches
= total_branches
+ num_branches
66 for branch
in c_rev
.branches
:
67 branches
[branch
] = None
71 symbols
.update(branches
)
73 num_symbols
= len(symbols
.keys())
74 num_tags
= len(tags
.keys())
75 num_branches
= len(branches
.keys())
76 avg_tags
= total_tags
* 1.0 / line_count
77 avg_branches
= total_branches
* 1.0 / line_count
79 print ' Total CVS Revisions: %d\n' \
80 ' Total Unique Tags: %d\n' \
81 ' Peak Revision Tags: %d\n' \
82 ' Avg. Tags/Revision: %2.1f\n' \
83 ' Total Unique Branches: %d\n' \
84 'Peak Revision Branches: %d\n' \
85 'Avg. Branches/Revision: %2.1f\n' \
86 ' Total Unique Symbols: %d%s\n' \
95 num_symbols
== num_tags
+ num_branches
and ' ' or ' (!)',
99 if __name__
== "__main__":
102 print 'Usage: %s /path/to/cvs2svn-temporary-directory' \
103 % (os
.path
.basename(sys
.argv
[0]))
106 os
.chdir(sys
.argv
[1])