1
# Copyright (C) 2007-2011 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Tests for fetch between repositories of the same type."""
22
from bzrlib.tests.per_repository_vf import (
23
TestCaseWithRepository,
24
all_repository_vf_format_scenarios,
26
from bzrlib.tests.scenarios import load_tests_apply_scenarios
28
load_tests = load_tests_apply_scenarios
31
class TestSource(TestCaseWithRepository):
32
"""Tests for/about the results of Repository._get_source."""
34
scenarios = all_repository_vf_format_scenarios()
36
def test_no_absent_records_in_stream_with_ghosts(self):
37
# XXX: Arguably should be in per_interrepository but
38
# doesn't actually gain coverage there; need a specific set of
39
# permutations to cover it.
40
# bug lp:376255 was reported about this.
41
builder = self.make_branch_builder('repo')
42
builder.start_series()
43
builder.build_snapshot('tip', ['ghost'],
44
[('add', ('', 'ROOT_ID', 'directory', ''))],
45
allow_leftmost_as_ghost=True)
46
builder.finish_series()
47
b = builder.get_branch()
49
self.addCleanup(b.unlock)
51
source = repo._get_source(repo._format)
52
search = graph.PendingAncestryResult(['tip'], repo)
53
stream = source.get_stream(search)
54
for substream_type, substream in stream:
55
for record in substream:
56
self.assertNotEqual('absent', record.storage_kind,
57
"Absent record for %s" % (((substream_type,) + record.key),))