/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/__init__.py

  • Committer: Robey Pointer
  • Date: 2006-07-01 19:03:33 UTC
  • mfrom: (1829 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1830.
  • Revision ID: robey@lag.net-20060701190333-f58465aec4bd3412
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Benchmark test suite for bzr."""
19
19
 
20
20
import bzrlib
 
21
from bzrlib.tests.TestUtil import TestLoader
21
22
from bzrlib.bzrdir import BzrDir
22
 
from bzrlib.tests import TestLoader
23
23
from bzrlib.tests.blackbox import ExternalBase
24
24
 
25
25
class Benchmark(ExternalBase):
53
53
        self.build_tree(files)
54
54
 
55
55
    def make_many_commit_tree(self, directory_name='.'):
56
 
        """Create a tree with an egregious number of commits.
 
56
        """Create a tree with many commits.
57
57
        
58
58
        No files change are included.
59
59
        """
74
74
                tree.unlock()
75
75
        return tree
76
76
 
 
77
    def make_heavily_merged_tree(self, directory_name='.'):
 
78
        """Create a tree in which almost every commit is a merge.
 
79
       
 
80
        No files change are included.  This produces two trees, 
 
81
        one of which is returned.  Except for the first commit, every
 
82
        commit in its revision-history is a merge another commit in the other
 
83
        tree.
 
84
        """
 
85
        tree = BzrDir.create_standalone_workingtree(directory_name)
 
86
        tree.lock_write()
 
87
        try:
 
88
            tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
 
89
            tree2.lock_write()
 
90
            try:
 
91
                for i in xrange(250):
 
92
                    revision_id = tree.commit('no-changes commit %d-a' % i)
 
93
                    tree2.branch.fetch(tree.branch, revision_id)
 
94
                    tree2.set_pending_merges([revision_id])
 
95
                    revision_id = tree2.commit('no-changes commit %d-b' % i)
 
96
                    tree.branch.fetch(tree2.branch, revision_id)
 
97
                    tree.set_pending_merges([revision_id])
 
98
                tree.set_pending_merges([])
 
99
            finally:
 
100
                tree.unlock()
 
101
        finally:
 
102
            tree2.unlock()
 
103
        return tree
 
104
 
77
105
 
78
106
def test_suite():
79
107
    """Build and return a TestSuite which contains benchmark tests only."""