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 results of running pass 1 of cvs2svn on
20 that repository. NOTE: You have to run the conversion passes
24 import sys
, os
, os
.path
, string
25 from cvs2svn
import CVSRevision
28 fp
= open(revs_file
, 'r')
39 line_count
= line_count
+ 1
44 # Get a CVSRevision to describe this line
45 c_rev
= CVSRevision(None, line
)
48 num_tags
= len(c_rev
.tags
)
49 max_tags
= (num_tags
> max_tags
) \
50 and num_tags
or max_tags
51 total_tags
= total_tags
+ num_tags
52 for tag
in c_rev
.tags
:
56 num_branches
= len(c_rev
.branches
)
57 max_branches
= (num_branches
> max_branches
) \
58 and num_branches
or max_branches
59 total_branches
= total_branches
+ num_branches
60 for branch
in c_rev
.branches
:
61 branches
[branch
] = None
65 symbols
.update(branches
)
67 num_symbols
= len(symbols
.keys())
68 num_tags
= len(tags
.keys())
69 num_branches
= len(branches
.keys())
70 avg_tags
= total_tags
* 1.0 / line_count
71 avg_branches
= total_branches
* 1.0 / line_count
73 print ' Total CVS Revisions: %d\n' \
74 ' Total Unique Tags: %d\n' \
75 ' Peak Revision Tags: %d\n' \
76 ' Avg. Tags/Revision: %2.1f\n' \
77 ' Total Unique Branches: %d\n' \
78 'Peak Revision Branches: %d\n' \
79 'Avg. Branches/Revision: %2.1f\n' \
80 ' Total Unique Symbols: %d%s\n' \
89 num_symbols
== num_tags
+ num_branches
and ' ' or ' (!)',
93 if __name__
== "__main__":
96 print 'Usage: %s /path/to/cvs2svn-data.[c-|s-|]revs' \
97 % (os
.path
.basename(sys
.argv
[0]))