Rev 4996: (Jelmer) Remove obsolete (and broken) biobench and history2revfiles in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Feb 1 13:53:26 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4996 [merge]
revision-id: pqm at pqm.ubuntu.com-20100201135324-cuhuolr97guf5xjp
parent: pqm at pqm.ubuntu.com-20100201125309-4nitvjqjlp05b7vt
parent: jelmer at samba.org-20100131115148-q6zdhme3ettofek4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-02-01 13:53:24 +0000
message:
  (Jelmer) Remove obsolete (and broken) biobench and history2revfiles
  	tools.
removed:
  tools/biobench.py              biobench.py-20051101131608-0942e1592d0a8ba9
  tools/history2revfiles.py      history2revfiles.py-20050811180808-5a139eeb2c8ba9a2
=== removed file 'tools/biobench.py'
--- a/tools/biobench.py	2005-11-04 01:46:31 +0000
+++ b/tools/biobench.py	1970-01-01 00:00:00 +0000
@@ -1,92 +0,0 @@
-#! /usr/bin/env python
-
-# (C) 2005 Canonical Ltd
-
-"""Benchmark for basicio
-
-Tries serializing an inventory to basic_io repeatedly.
-"""
-
-if True:
-    import psyco
-    psyco.full()
-
-
-import sys
-from timeit import Timer
-from tempfile import TemporaryFile, NamedTemporaryFile
-
-from bzrlib.branch import Branch
-from bzrlib.xml5 import serializer_v5
-from bzrlib.basicio import write_inventory, BasicWriter, \
-        read_inventory
-from bzrlib.inventory import Inventory, InventoryEntry, InventoryFile, ROOT_ID
-
-## b = Branch.open('.')
-## inv = b.get_inventory(b.last_revision())
-
-nrepeats = 3
-ntimes = 5
-NFILES = 30000
-
-def make_inventory():
-    inv = Inventory()
-    for i in range(NFILES):
-        ie = InventoryFile('%08d-id' % i, '%08d-file' % i, ROOT_ID)
-        ie.text_sha1='1212121212121212121212121212121212121212'
-        ie.text_size=12312
-        inv.add(ie)
-    return inv
-
-inv = make_inventory()
-
-bio_tmp = NamedTemporaryFile()
-xml_tmp = NamedTemporaryFile()
-
-def bio_test():
-    bio_tmp.seek(0)
-    w = BasicWriter(bio_tmp)
-    write_inventory(w, inv)
-    bio_tmp.seek(0)
-    new_inv = read_inventory(bio_tmp)
-
-def xml_test():
-    xml_tmp.seek(0)
-    serializer_v5.write_inventory(inv, xml_tmp)
-    xml_tmp.seek(0)
-    new_inv = serializer_v5.read_inventory(xml_tmp)
-
-def run_benchmark(function_name, tmp_file):
-    t = Timer(function_name + '()', 
-              'from __main__ import ' + function_name)
-    times = t.repeat(nrepeats, ntimes)
-    tmp_file.seek(0, 2)
-    size = tmp_file.tell()
-    print 'wrote inventory to %10s %5d times, each %6d bytes, total %6dkB' \
-            % (function_name, ntimes, size, (size * ntimes)>>10), 
-    each = (min(times)/ntimes*1000)
-    print 'in %.1fms each' % each 
-    return each
-
-def profileit(fn): 
-    import hotshot, hotshot.stats
-    prof_f = NamedTemporaryFile()
-    prof = hotshot.Profile(prof_f.name)
-    prof.runcall(fn) 
-    prof.close()
-    stats = hotshot.stats.load(prof_f.name)
-    #stats.strip_dirs()
-    stats.sort_stats('time')
-    ## XXX: Might like to write to stderr or the trace file instead but
-    ## print_stats seems hardcoded to stdout
-    stats.print_stats(20)
-
-if '-p' in sys.argv[1:]:
-    profileit(bio_test)
-else:
-    bio_each = run_benchmark('bio_test', bio_tmp)
-    xml_each = run_benchmark('xml_test', xml_tmp)
-    print 'so bio is %.1f%% faster' % (100 * ((xml_each / bio_each) - 1))
-
-# make sure it was a fair comparison
-# assert 'cElementTree' in sys.modules

=== removed file 'tools/history2revfiles.py'
--- a/tools/history2revfiles.py	2009-03-23 14:59:43 +0000
+++ b/tools/history2revfiles.py	1970-01-01 00:00:00 +0000
@@ -1,99 +0,0 @@
-#! /usr/bin/python
-
-# Copyright (C) 2005 Canonical Ltd
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-"""Experiment in converting existing bzr branches to weaves."""
-
-
-import bzrlib.branch
-from bzrlib.revfile import Revfile
-from bzrlib.progress import ProgressBar
-import tempfile
-import hotshot, hotshot.stats
-import sys
-
-def convert():
-    pb = ProgressBar()
-
-    inv_rf = Revfile('revfiles/inventory', 'w')
-    last_text_sha = {}
-    text_rfs = {}
-
-    b = bzrlib.branch.find_branch('.')
-
-    revno = 1
-    rev_history = b.revision_history()
-    last_idx = None
-    for rev_id in rev_history:
-        pb.update('converting inventory', revno, len(rev_history))
-        inv_xml = b.get_inventory_xml(rev_id).read()
-        new_idx = inv_rf.add(inv_xml, last_idx, compress=False)
-
-        tree = b.revision_tree(rev_id)
-        inv = tree.inventory
-
-        # for each file in the inventory, put it into its own revfile
-        for file_id in inv:
-            ie = inv[file_id]
-            if ie.kind != 'file':
-                continue
-            if last_text_sha.get(file_id) == ie.text_sha1:
-                # same as last time
-                continue
-            last_text_sha[file_id] = ie.text_sha1
-
-            # new text (though possibly already stored); need to store it
-            text = tree.get_file(file_id).read()
-            
-            if file_id not in text_rfs:
-                text_rfs[file_id] = Revfile('revfiles/' + file_id, 'w')
-            rf = text_rfs[file_id]
-
-            last = len(rf)
-            if last == 0:
-                last = None
-            else:
-                last -= 1
-            rf.add(text, last, compress=True)
-        
-        last_idx = new_idx
-        revno += 1
-
-    pb.clear()
-
-
-def profile_convert(): 
-    prof_f = tempfile.NamedTemporaryFile()
-
-    prof = hotshot.Profile(prof_f.name)
-
-    prof.runcall(convert) 
-    prof.close()
-
-    stats = hotshot.stats.load(prof_f.name)
-    #stats.strip_dirs()
-    stats.sort_stats('time')
-    ## XXX: Might like to write to stderr or the trace file instead but
-    ## print_stats seems hardcoded to stdout
-    stats.print_stats(20)
-            
-
-if '-p' in sys.argv[1:]:
-    profile_convert()
-else:
-    convert()
-    




More information about the bazaar-commits mailing list