157
157
# tag into the kept archive
158
158
pybaz.Revision(self._missing_import + '--base-0').make_continuation(
159
159
pybaz.Version(self._missing_ancestor))
161
# make an import for testing history-reuse logic.
164
# note the use of a namespace layout here.
165
self._missing_import_imported = os.path.join(self._tmpdir,
167
os.mkdir(os.path.join(self._tmpdir, 'archivegone-bzr'))
168
os.mkdir(os.path.join(self._tmpdir, 'archivegone-bzr', 'c'))
169
import_version(os.path.join(self._tmpdir, 'archivegone-bzr',
171
pybaz.Version(self._missing_import),
160
173
# and make it inaccessible
161
174
pybaz.Archive('demo-gone@DONOTUSE').unregister()
271
284
self.assertEqual(rev.committer, "Test User<test@example.org>")
272
285
self.assertEqual(rev.message, "tag of demo@DONOTUSE/c--import--0--base-0")
273
286
self.assertEqual(rev.revision_id, self._baz._empty_merged_tag_bzr_base)
287
self.assertEqual(['Arch-1:demo@DONOTUSE%c--import--0--base-0'],
275
290
# check next revisions in the history.
276
291
rev = branch.get_revision(self._baz._empty_merged_tag_bzr)
404
419
self.assertRaises(NoSuchRevision, branch.get_revision,
405
420
self._baz._missing_import_bzr)
422
def test_missing_ancestor_reusing_history(self):
423
import_version('output', pybaz.Version(self._baz._missing_ancestor),
425
reuse_history_from=[self._baz._missing_import_imported])
427
# one commits, no files, revision identifiers of
428
# 'demo-gone@DONOTUSE%c--import--0--base-0' and
429
# 'demo@DONOTUSE%c--gone--0--base-0'
430
branch = Branch.open('output')
431
self.assertEqual(branch.revision_history(),
432
[self._baz._missing_import_bzr,
433
self._baz._missing_ancestor_bzr])
434
rev = branch.get_revision(self._baz._missing_ancestor_bzr)
436
import_version('output2', pybaz.Version(self._baz._missing_ancestor),
438
reuse_history_from=[self._baz._missing_import_imported])
439
branch2 = Branch.open('output2')
440
self.assertEqual(branch.revision_history(), branch2.revision_history())
441
rev2 = branch2.get_revision(self._baz._missing_ancestor_bzr)
442
# they must be the same
443
self.assertEqual(rev, rev2)
445
# must be able to get the missing base revision
446
branch.get_revision(self._baz._missing_import_bzr)
448
# and we should get some expected values:
449
self.assertEqual(rev.committer, "Test User<test@example.org>")
450
self.assertEqual(rev.message, "tag of demo-gone@DONOTUSE/c--import--0--base-0")
451
self.assertEqual(rev.revision_id, self._baz._missing_ancestor_bzr)
452
self.assertEqual(rev.parent_ids[0], self._baz._missing_import_bzr)
453
self.assertEqual(1, len(rev.parent_ids))
407
455
def test_bad_file_id(self):
408
456
import_version('output', pybaz.Version(self._baz._bad_id_tag),
595
643
command = cmd_baz_import()
596
644
command.run(os.path.join(self._tmpdir, 'output'), 'demo@DONOTUSE')
597
645
command.run(os.path.join(self._tmpdir, 'output'), 'demo@DONOTUSE')
647
def test_accepts_reuse_history(self):
648
self.make_import('c--0')
649
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),
650
'demo@DONOTUSE', '.', '.')
652
def test_does_not_need_reuse_history(self):
653
self.make_import('c--0')
654
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),