147
148
def test_fetch_to_rich_root_set_parent_1_parent(self):
148
# 1 parent rev -> 1 parent
149
# 1 parent rev -> 1 parent
149
150
self.do_test_fetch_to_rich_root_sets_parents_correctly(
150
151
((ROOT_ID, 'base'),),
151
152
[('base', None, [('add', ('', ROOT_ID, 'directory', ''))]),
300
301
repo.fetch(tree.branch.repository)
301
302
repo.fetch(tree.branch.repository)
304
def make_simple_branch_with_ghost(self):
305
builder = self.make_branch_builder('source')
306
builder.start_series()
307
builder.build_snapshot('A-id', None, [
308
('add', ('', 'root-id', 'directory', None)),
309
('add', ('file', 'file-id', 'file', 'content\n'))])
310
builder.build_snapshot('B-id', ['A-id', 'ghost-id'], [])
311
builder.finish_series()
312
source_b = builder.get_branch()
314
self.addCleanup(source_b.unlock)
317
def test_fetch_with_ghost(self):
318
source_b = self.make_simple_branch_with_ghost()
319
target = self.make_repository('target')
321
self.addCleanup(target.unlock)
322
target.fetch(source_b.repository, revision_id='B-id')
324
def test_fetch_into_smart_with_ghost(self):
325
trans = self.make_smart_server('target')
326
source_b = self.make_simple_branch_with_ghost()
327
target = self.make_repository('target')
328
# Re-open the repository over the smart protocol
329
target = repository.Repository.open(trans.base)
331
self.addCleanup(target.unlock)
333
target.fetch(source_b.repository, revision_id='B-id')
334
except errors.TokenLockingNotSupported:
335
# The code inside fetch() that tries to lock and then fails, also
336
# causes weird problems with 'lock_not_held' later on...
338
raise tests.KnownFailure('some repositories fail to fetch'
339
' via the smart server because of locking issues.')
341
def test_fetch_from_smart_with_ghost(self):
342
trans = self.make_smart_server('source')
343
source_b = self.make_simple_branch_with_ghost()
344
target = self.make_repository('target')
346
self.addCleanup(target.unlock)
347
# Re-open the repository over the smart protocol
348
source = repository.Repository.open(trans.base)
350
self.addCleanup(source.unlock)
351
target.fetch(source, revision_id='B-id')
304
354
class TestSource(TestCaseWithRepository):
305
355
"""Tests for/about the results of Repository._get_source."""