/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/tree_creator/many_commit.py

  • Committer: Carl Friedrich Bolz
  • Date: 2006-08-30 19:44:06 UTC
  • mto: (1908.3.21 usecases-benchmarks)
  • mto: This revision was merged to the branch mainline in revision 2068.
  • Revision ID: cfbolz@gmx.de-20060830194406-969c5f912785214b
Fix problems pointed out by John:
  * Actually benchmark install_bundle too.
  * Fix PEP 8 issues.
  * Fix caching of trees by using names dependant on the parameters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    """Create an tree many files and many commits."""
28
28
 
29
29
    def __init__(self, test, link_bzr=False, num_files=10, num_commits=10):
 
30
        tree_name = 'many_files_many_commit_tree_%d_%d' % (
 
31
            num_files, num_commits)
30
32
        super(ManyCommitTreeCreator, self).__init__(test,
31
 
            tree_name='many_files_many_commit_tree',
 
33
            tree_name=tree_name,
32
34
            link_bzr=link_bzr,
33
35
            link_working=False,
34
36
            hot_cache=True)
39
41
    def _create_tree(self, root, in_cache=False):
40
42
        num_files = self.num_files
41
43
        num_commits = self.num_commits
42
 
        files = ["%s/%s" % (root, i) for i in range(num_files)]
 
44
        files = ["%s/%s" % (root, fn) for fn in self.files]
43
45
        for fn in files:
44
46
            f = open(fn, "wb")
45
47
            try:
47
49
            finally:
48
50
                f.close()
49
51
        tree = bzrdir.BzrDir.create_standalone_workingtree(root)
50
 
        tree.add([str(i) for i in range(num_files)])
 
52
        tree.add(self.files)
51
53
        tree.lock_write()
52
54
        try:
53
55
            tree.commit('initial commit')
62
64
                tree.commit("changing file %s" % fn)
63
65
        finally:
64
66
            tree.unlock()
65
 
        self.files = ["%s" % (i, ) for i in range(num_files)]
66
67
        return tree
67
68