~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for fetch between repositories of the same type."""
18
18
 
19
19
from bzrlib import (
20
 
    bzrdir,
 
20
    controldir,
21
21
    errors,
22
22
    gpg,
23
23
    remote,
24
24
    repository,
25
 
    tests,
26
25
    )
27
26
from bzrlib.inventory import ROOT_ID
28
27
from bzrlib.tests import (
68
67
        tree_a.add('foo', 'file1')
69
68
        tree_a.commit('rev1', rev_id='rev1')
70
69
        # create a knit-3 based format to fetch into
71
 
        f = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
 
70
        f = controldir.format_registry.make_bzrdir('development-subtree')
72
71
        try:
73
72
            format = tree_a.branch.repository._format
74
73
            format.check_conversion_target(f.repository_format)
102
101
                              % b_bzrdir.transport)
103
102
        tree_b.commit('no change', rev_id='rev2')
104
103
        rev2_tree = knit3_repo.revision_tree('rev2')
105
 
        self.assertEqual('rev1', rev2_tree.inventory.root.revision)
 
104
        self.assertEqual(
 
105
            'rev1',
 
106
            rev2_tree.get_file_revision(rev2_tree.get_root_id()))
106
107
 
107
108
    def do_test_fetch_to_rich_root_sets_parents_correctly(self, result,
108
109
        snapshots, root_id=ROOT_ID, allow_lefthand_ghost=False):
157
158
 
158
159
    def test_fetch_to_rich_root_set_parent_1_ghost_parent(self):
159
160
        # 1 ghost parent -> No parents
 
161
        if not self.repository_format.supports_ghosts:
 
162
            raise TestNotApplicable("repository format does not support "
 
163
                 "ghosts")
160
164
        self.do_test_fetch_to_rich_root_sets_parents_correctly((),
161
165
            [('tip', ['ghost'], [('add', ('', ROOT_ID, 'directory', ''))]),
162
166
            ], allow_lefthand_ghost=True)
333
337
    def test_fetch_into_smart_with_ghost(self):
334
338
        trans = self.make_smart_server('target')
335
339
        source_b = self.make_simple_branch_with_ghost()
 
340
        if not source_b.bzrdir._format.supports_transport(trans):
 
341
            raise TestNotApplicable("format does not support transport")
336
342
        target = self.make_repository('target')
337
343
        # Re-open the repository over the smart protocol
338
344
        target = repository.Repository.open(trans.base)
344
350
            # The code inside fetch() that tries to lock and then fails, also
345
351
            # causes weird problems with 'lock_not_held' later on...
346
352
            target.lock_read()
347
 
            raise tests.KnownFailure('some repositories fail to fetch'
 
353
            self.knownFailure('some repositories fail to fetch'
348
354
                ' via the smart server because of locking issues.')
349
355
 
350
356
    def test_fetch_from_smart_with_ghost(self):
351
357
        trans = self.make_smart_server('source')
352
358
        source_b = self.make_simple_branch_with_ghost()
 
359
        if not source_b.bzrdir._format.supports_transport(trans):
 
360
            raise TestNotApplicable("format does not support transport")
353
361
        target = self.make_repository('target')
354
362
        target.lock_write()
355
363
        self.addCleanup(target.unlock)