~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository_vf/test_fetch.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 08:15:14 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101008081514-dviqzrdfwyzsqbz2
Split NEWS into per-release doc/en/release-notes/bzr-*.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
2
 
#
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.
7
 
#
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.
12
 
#
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
16
 
 
17
 
"""Tests for fetch between repositories of the same type."""
18
 
 
19
 
from bzrlib import (
20
 
    vf_search,
21
 
    )
22
 
from bzrlib.tests.per_repository_vf import (
23
 
    TestCaseWithRepository,
24
 
    all_repository_vf_format_scenarios,
25
 
    )
26
 
from bzrlib.tests.scenarios import load_tests_apply_scenarios
27
 
 
28
 
load_tests = load_tests_apply_scenarios
29
 
 
30
 
 
31
 
class TestSource(TestCaseWithRepository):
32
 
    """Tests for/about the results of Repository._get_source."""
33
 
 
34
 
    scenarios = all_repository_vf_format_scenarios()
35
 
 
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()
48
 
        b.lock_read()
49
 
        self.addCleanup(b.unlock)
50
 
        repo = b.repository
51
 
        source = repo._get_source(repo._format)
52
 
        search = vf_search.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),))