61
61
self.separate_authors_found = False
62
62
self.symlinks_found = False
63
63
self.executables_found = False
64
self.sha_blob_references = False
64
65
self.lightweight_tags = 0
65
66
self.named_branches = []
69
for usage in ['new', 'used', 'multi', 'unknown']:
70
self.blobs[usage] = set()
67
73
def post_process(self):
69
note("Command counts:")
70
for cmd in commands.COMMAND_NAMES:
71
note("\t%d\t%s", self.cmd_counts[cmd], cmd)
72
note("File command counts:")
73
for fc in commands.FILE_COMMAND_NAMES:
74
note("\t%d\t%s", self.file_cmd_counts[fc], fc)
76
note('# Configuration file generated by bzr fast-import --info')
77
cmd_names = commands.COMMAND_NAMES
78
fc_names = commands.FILE_COMMAND_NAMES
79
cmd_values = [self.cmd_counts[c] for c in cmd_names]
80
fc_values = [self.file_cmd_counts[c] for c in fc_names]
81
self._dump_stats_group("Command counts", cmd_names, cmd_values, str)
82
self._dump_stats_group("File command counts", fc_names, fc_values, str)
75
85
if self.cmd_counts['commit']:
76
note("Parent counts:")
77
88
for i in xrange(0, _MAX_PARENTS):
78
89
count = self.parent_counts[i]
80
note("\t%d\t%d", count, i)
81
note("Other commit information:")
82
note("\t%d\t%s" % (len(self.committers), 'unique committers'))
83
note("\t%s\t%s" % (_found(self.separate_authors_found),
85
note("\t%s\t%s" % (_found(self.executables_found), 'executables'))
86
note("\t%s\t%s" % (_found(self.symlinks_found), 'symlinks'))
91
p_names.append("parents-%d" % i)
92
p_values.append(count)
94
'separate authors found': self.separate_authors_found,
95
'executables': self.executables_found,
96
'symlinks': self.symlinks_found,
97
'blobs referenced by SHA': self.sha_blob_references,
99
self._dump_stats_group("Parent counts", p_names, p_values, str)
100
self._dump_stats_group("Commit analysis", flags.keys(),
101
flags.values(), _found)
102
# note("\t%d\t%s" % (len(self.committers), 'unique committers'))
105
if self.cmd_counts['blob']:
106
# In verbose mode, don't list every blob used
108
del self.blobs['used']
109
self._dump_stats_group("Blob usage tracking", self.blobs.keys(),
110
self.blobs.values(), len)
87
113
if self.cmd_counts['reset']:
88
note("Reset information:")
89
note("\t%d\t%s" % (self.lightweight_tags, 'of the reset commands are lightweight tags'))
90
note("\t%s\t%s" % ('others', self.named_branches))
115
'lightweight tags': self.lightweight_tags,
116
'other resets': self.named_branches,
118
self._dump_stats_group("Reset analysis", reset_stats.keys(),
119
reset_stats.values())
121
def _dump_stats_group(self, title, names, values, formatter):
122
"""Dump a statistics group.
124
In verbose mode, do so as a config file so
125
that other processors can load the information if they want to.
128
print "[%s]" % (title,)
129
for name, value in zip(names, values):
130
print "%s = %s" % (name.replace(' ', '-'),value)
133
print "%s:" % (title,)
134
for name, value in zip(names, values):
135
if formatter is not None:
136
value = formatter(value)
137
print "\t%s\t%s" % (value,name)
92
139
def progress_handler(self, cmd):
93
140
"""Process a ProgressCommand."""