~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-16 01:25:46 UTC
  • mfrom: (2071 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2080.
  • Revision ID: john@arbash-meinel.com-20061016012546-d01a0740671b4d73
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        creator = HeavilyMergedTreeCreator(self, link_bzr=hardlink)
128
128
        return creator.create(root=directory_name)
129
129
 
130
 
    def create_with_commits(self, num_files, num_commits, directory_name='.'):
 
130
    def create_with_commits(self, num_files, num_commits, directory_name='.',
 
131
                            hardlink=False):
131
132
        """Create a tree with many files and many commits. Every commit changes
132
133
        exactly one file.
133
134
        
134
135
        :param num_files: number of files to be created
135
136
        :param num_commits: number of commits in the newly created tree
136
137
        """
137
 
        files = ["%s/%s" % (directory_name, i) for i in range(num_files)]
138
 
        for fn in files:
139
 
            f = open(fn, "wb")
140
 
            try:
141
 
                f.write("some content\n")
142
 
            finally:
143
 
                f.close()
144
 
        tree = bzrdir.BzrDir.create_standalone_workingtree(directory_name)
145
 
        tree.add([str(i) for i in range(num_files)])
146
 
        tree.lock_write()
147
 
        try:
148
 
            tree.commit('initial commit')
149
 
            for i in range(num_commits):
150
 
                fn = files[i % len(files)]
151
 
                content = range(i) + [i, i, i, ""]
152
 
                f = open(fn, "wb")
153
 
                try:
154
 
                    f.write("\n".join([str(i) for i in content]))
155
 
                finally:
156
 
                    f.close()
157
 
                tree.commit("changing file %s" % fn)
158
 
        finally:
159
 
            tree.unlock()
 
138
        from bzrlib.benchmarks.tree_creator.many_commit import (
 
139
            ManyCommitTreeCreator,
 
140
            )
 
141
        creator = ManyCommitTreeCreator(self, link_bzr=hardlink,
 
142
                                        num_files=num_files,
 
143
                                        num_commits=num_commits)
 
144
        tree = creator.create(root=directory_name)
 
145
        files = ["%s/%s" % (directory_name, fn) for fn in creator.files]
160
146
        return tree, files
161
147
 
162
148
    def commit_some_revisions(self, tree, files, num_commits,
187
173
    testmod_names = [ \
188
174
                   'bzrlib.benchmarks.bench_add',
189
175
                   'bzrlib.benchmarks.bench_bench',
 
176
                   'bzrlib.benchmarks.bench_bundle',
190
177
                   'bzrlib.benchmarks.bench_cache_utf8',
191
178
                   'bzrlib.benchmarks.bench_checkout',
192
179
                   'bzrlib.benchmarks.bench_commit',
 
180
                   'bzrlib.benchmarks.bench_info',
193
181
                   'bzrlib.benchmarks.bench_inventory',
194
182
                   'bzrlib.benchmarks.bench_log',
195
183
                   'bzrlib.benchmarks.bench_osutils',
196
184
                   'bzrlib.benchmarks.bench_rocks',
 
185
                   'bzrlib.benchmarks.bench_startup',
197
186
                   'bzrlib.benchmarks.bench_status',
198
187
                   'bzrlib.benchmarks.bench_transform',
199
188
                   'bzrlib.benchmarks.bench_workingtree',