Rev 6145: Quick-and-dirty hack to get a list of options to migrate. in file:///home/vila/src/bzr/experimental/more-config-stats/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Sep 20 09:23:49 UTC 2011
At file:///home/vila/src/bzr/experimental/more-config-stats/
------------------------------------------------------------
revno: 6145
revision-id: v.ladeuil+lp at free.fr-20110920092348-mx48o50ra4ffkev7
parent: pqm at pqm.ubuntu.com-20110916132714-w81xvesg996w68r6
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: more-config-stats
timestamp: Tue 2011-09-20 11:23:48 +0200
message:
Quick-and-dirty hack to get a list of options to migrate.
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2011-09-14 17:17:25 +0000
+++ b/bzrlib/tests/__init__.py 2011-09-20 09:23:48 +0000
@@ -1054,6 +1054,8 @@
self.addDetail(counter_name, content.Content(content.UTF8_TEXT,
lambda: ['%d' % (_counters[counter_name],)]))
def increment_counter(*args, **kwargs):
+ if counter_name == 'old_config.get':
+ sys.__stderr__.write('old_config.get: %s\n' % (args[1]))
_counters[counter_name] += 1
label = 'count %s calls' % (counter_name,)
hooks.install_named_hook(name, increment_counter, label)
=== modified file 'tools/subunit-sum'
--- a/tools/subunit-sum 2011-06-16 10:45:17 +0000
+++ b/tools/subunit-sum 2011-09-20 09:23:48 +0000
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-"""Displays the sum of a counter found in a subunit stream.
+"""Displays the sum of one or several counters found in a subunit stream.
Each test have (or not) the counter as a named detail in the stream.
"""
@@ -33,11 +33,6 @@
testtools.TestResult.__init__(self)
self.counter_names = counter_names
self.totals = {}
- self.longest = 0
- for name in counter_names:
- l = len(name)
- if l > self.longest: self.longest = l
- self.totals[name] = 0
def addSuccess(self, test, details):
for name in self.counter_names:
@@ -46,12 +41,16 @@
except KeyError, e:
# this counter doesn't exist for the test
continue
+ self.totals.setdefault(name, 0)
self.totals[name] += int(counter_text)
def display_totals(self, stream):
+ longest = 0
+ for name in counter_names:
+ l = len(name)
+ if l > longest: longest = l
for name in self.counter_names:
- stream.write('%-*s: %s\n'
- % (self.longest, name, self.totals[name]))
+ stream.write('%-*s: %s\n' % (longest, name, self.totals[name]))
counter_names = sys.argv[1:]
More information about the bazaar-commits
mailing list