Rev 4361: Don't return ghosts in the keyset for PendingAncestryResult. in http://people.ubuntu.com/~robertc/baz2.0/pending/repo-source
Robert Collins
robertc at robertcollins.net
Thu May 14 06:46:22 BST 2009
At http://people.ubuntu.com/~robertc/baz2.0/pending/repo-source
------------------------------------------------------------
revno: 4361
revision-id: robertc at robertcollins.net-20090514054614-om3zdqkpaxs52b0l
parent: pqm at pqm.ubuntu.com-20090513232416-vt21661225sx5v8m
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repo-source
timestamp: Thu 2009-05-14 15:46:14 +1000
message:
Don't return ghosts in the keyset for PendingAncestryResult.
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py 2009-04-04 02:50:01 +0000
+++ b/bzrlib/graph.py 2009-05-14 05:46:14 +0000
@@ -1556,7 +1556,7 @@
def _get_keys(self, graph):
NULL_REVISION = revision.NULL_REVISION
keys = [key for (key, parents) in graph.iter_ancestry(self.heads)
- if key != NULL_REVISION]
+ if key != NULL_REVISION and parents is not None]
return keys
def is_empty(self):
=== modified file 'bzrlib/tests/per_repository/test_fetch.py'
--- a/bzrlib/tests/per_repository/test_fetch.py 2009-05-07 05:08:46 +0000
+++ b/bzrlib/tests/per_repository/test_fetch.py 2009-05-14 05:46:14 +0000
@@ -20,6 +20,7 @@
bzrdir,
errors,
gpg,
+ graph,
remote,
repository,
)
@@ -298,3 +299,29 @@
revision_id = tree.commit('test')
repo.fetch(tree.branch.repository)
repo.fetch(tree.branch.repository)
+
+
+class TestSource(TestCaseWithRepository):
+ """Tests for/about the results of Repository._get_source."""
+
+ def test_no_absent_records_in_stream_with_ghosts(self):
+ # XXX: Arguably should be in interrepository_implementations but
+ # doesn't actually gain coverage there; need a specific set of
+ # permutations to cover it.
+ builder = self.make_branch_builder('repo')
+ builder.start_series()
+ builder.build_snapshot('tip', ['ghost'],
+ [('add', ('', 'ROOT_ID', 'directory', ''))],
+ allow_leftmost_as_ghost=True)
+ builder.finish_series()
+ b = builder.get_branch()
+ b.lock_read()
+ self.addCleanup(b.unlock)
+ repo = b.repository
+ source = repo._get_source(repo._format)
+ search = graph.PendingAncestryResult(['tip'], repo)
+ stream = source.get_stream(search)
+ for substream_type, substream in stream:
+ for record in substream:
+ self.assertNotEqual('absent', record.storage_kind,
+ "Absent record for %s" % (((substream_type,) + record.key),))
More information about the bazaar-commits
mailing list