Rev 4599: Fix the second half of bug #402778 in http://bazaar.launchpad.net/~jameinel/bzr/1.19-bug-402778
John Arbash Meinel
john at arbash-meinel.com
Tue Aug 11 18:29:37 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.19-bug-402778
------------------------------------------------------------
revno: 4599
revision-id: john at arbash-meinel.com-20090811172931-zzc9vsx6ey18psw8
parent: john at arbash-meinel.com-20090811172245-kzlpt9lxvrn0700o
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.19-bug-402778
timestamp: Tue 2009-08-11 12:29:31 -0500
message:
Fix the second half of bug #402778
The code wasn't paying attention that some of the revisions being fetched
might have ghost parents, and was then failing to insert ghosts.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-08-11 02:58:23 +0000
+++ b/NEWS 2009-08-11 17:29:31 +0000
@@ -21,6 +21,11 @@
* Further tweaks to handling of ``bzr add`` messages about ignored files.
(Jason Spashett, #76616)
+* Properly handle fetching into a stacked branch while converting the
+ data, especially when there are also ghosts. The code was filling in
+ parent inventories incorrectly, and also not handling when one of the
+ parents was a ghost. (John Arbash Meinel, #402778)
+
Improvements
************
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-08-11 17:22:45 +0000
+++ b/bzrlib/repository.py 2009-08-11 17:29:31 +0000
@@ -3808,6 +3808,8 @@
# for the new revisions that we are about to insert. We do this
# before adding the revisions so that no revision is added until
# all the inventories it may depend on are added.
+ # Note that this is overzealous, as we may have fetched these in an
+ # earlier batch.
parent_ids = set()
revision_ids = set()
for revision in pending_revisions:
@@ -3816,7 +3818,9 @@
parent_ids.difference_update(revision_ids)
parent_ids.discard(_mod_revision.NULL_REVISION)
parent_map = self.source.get_parent_map(parent_ids)
- for parent_tree in self.source.revision_trees(parent_ids):
+ # we iterate over parent_map and not parent_ids because we don't
+ # want to try copying any revision which is a ghost
+ for parent_tree in self.source.revision_trees(parent_map.keys()):
current_revision_id = parent_tree.get_revision_id()
parents_parents = parent_map[current_revision_id]
basis_id, delta = self._get_delta_for_revision(parent_tree,
=== modified file 'bzrlib/tests/per_interrepository/test_fetch.py'
--- a/bzrlib/tests/per_interrepository/test_fetch.py 2009-08-11 17:22:45 +0000
+++ b/bzrlib/tests/per_interrepository/test_fetch.py 2009-08-11 17:29:31 +0000
@@ -132,6 +132,9 @@
altered by all revisions it contains, which means that it needs both
the inventory for any revision it has, and the inventories of all that
revision's parents.
+
+ However, we should also skip any revisions which are ghosts in the
+ parents.
"""
to_repo = self.make_to_repository('to')
if not to_repo._format.supports_external_lookups:
@@ -145,7 +148,7 @@
('modify', ('file-id', 'left content\n'))])
builder.build_snapshot('right', ['base'], [
('modify', ('file-id', 'right content\n'))])
- builder.build_snapshot('merge', ['left', 'right'], [
+ builder.build_snapshot('merge', ['left', 'right', 'ghost'], [
('modify', ('file-id', 'left and right content\n'))])
builder.finish_series()
branch = builder.get_branch()
@@ -162,6 +165,7 @@
self.addCleanup(unstacked_repo.unlock)
self.assertFalse(unstacked_repo.has_revision('left'))
self.assertFalse(unstacked_repo.has_revision('right'))
+ # 'ghost' should not be present
self.assertEqual(
set([('left',), ('right',), ('merge',)]),
unstacked_repo.inventories.keys())
More information about the bazaar-commits
mailing list