125
127
creator = HeavilyMergedTreeCreator(self, link_bzr=hardlink)
126
128
return creator.create(root=directory_name)
130
def create_with_commits(self, num_files, num_commits, directory_name='.'):
131
"""Create a tree with many files and many commits. Every commit changes
134
:param num_files: number of files to be created
135
:param num_commits: number of commits in the newly created tree
137
files = ["%s/%s" % (directory_name, i) for i in range(num_files)]
141
f.write("some content\n")
144
tree = bzrdir.BzrDir.create_standalone_workingtree(directory_name)
145
tree.add([str(i) for i in range(num_files)])
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, ""]
154
f.write("\n".join([str(i) for i in content]))
157
tree.commit("changing file %s" % fn)
162
def commit_some_revisions(self, tree, files, num_commits,
164
"""Commit a specified number of revisions to some files in a tree,
165
makeing a specified number of changes per commit.
167
:param tree: The tree in which the changes happen.
168
:param files: The list of files where changes should occur.
169
:param num_commits: The number of commits
170
:param changes_per_commit: The number of files that are touched in
173
for j in range(num_commits):
174
for i in range(changes_per_commit):
175
fn = files[(i + j) % changes_per_commit]
176
content = range(i) + [i, i, i, '']
179
f.write("\n".join([str(k) for k in content]))
182
tree.commit("new revision")
129
185
def test_suite():
130
186
"""Build and return a TestSuite which contains benchmark tests only."""
141
197
'bzrlib.benchmarks.bench_status',
142
198
'bzrlib.benchmarks.bench_transform',
143
199
'bzrlib.benchmarks.bench_workingtree',
200
'bzrlib.benchmarks.bench_sftp',
144
201
'bzrlib.benchmarks.bench_xml',
146
203
suite = TestLoader().loadTestsFromModuleNames(testmod_names)