160
160
tree = wt.branch.repository.revision_tree(NULL_REVISION)
161
161
self.assertEqual([], list(tree.list_files(include_root=True)))
163
def test_fetch(self):
164
# smoke test fetch to ensure that the convenience function works.
165
# it is defined as a convenience function with the underlying
166
# functionality provided by an InterRepository
167
tree_a = self.make_branch_and_tree('a')
168
self.build_tree(['a/foo'])
169
tree_a.add('foo', 'file1')
170
tree_a.commit('rev1', rev_id='rev1')
171
# fetch with a default limit (grab everything)
172
repo = bzrdir.BzrDir.create_repository(self.get_url('b'))
173
if (tree_a.branch.repository.supports_rich_root() and not
174
repo.supports_rich_root()):
175
raise TestSkipped('Cannot fetch from model2 to model1')
176
repo.fetch(tree_a.branch.repository,
178
pb=bzrlib.progress.DummyProgress())
180
def test_fetch_knit3(self):
181
# create a repository of the sort we are testing.
182
tree_a = self.make_branch_and_tree('a', '')
183
self.build_tree(['a/foo'])
184
tree_a.add('foo', 'file1')
185
tree_a.commit('rev1', rev_id='rev1')
186
# create a knit-3 based format to fetch into
187
f = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
189
format = tree_a.branch.repository._format
190
format.check_conversion_target(f.repository_format)
191
# if we cannot convert data to knit3, skip the test.
192
except errors.BadConversionTarget, e:
193
raise TestSkipped(str(e))
194
self.get_transport().mkdir('b')
195
b_bzrdir = f.initialize(self.get_url('b'))
196
knit3_repo = b_bzrdir.create_repository()
197
# fetch with a default limit (grab everything)
198
knit3_repo.fetch(tree_a.branch.repository, revision_id=None)
199
rev1_tree = knit3_repo.revision_tree('rev1')
200
lines = rev1_tree.get_file_lines(rev1_tree.inventory.root.file_id)
201
self.assertEqual([], lines)
202
b_branch = b_bzrdir.create_branch()
203
b_branch.pull(tree_a.branch)
205
tree_b = b_bzrdir.create_workingtree()
206
except errors.NotLocalUrl:
207
raise TestSkipped("cannot make working tree with transport %r"
208
% b_bzrdir.transport)
209
tree_b.commit('no change', rev_id='rev2')
210
rev2_tree = knit3_repo.revision_tree('rev2')
211
self.assertEqual('rev1', rev2_tree.inventory.root.revision)
213
163
def test_get_revision_delta(self):
214
164
tree_a = self.make_branch_and_tree('a')
215
165
self.build_tree(['a/foo'])