~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_fetch.py

  • Committer: Robert Collins
  • Date: 2009-04-27 03:27:46 UTC
  • mto: This revision was merged to the branch mainline in revision 4304.
  • Revision ID: robertc@robertcollins.net-20090427032746-vqmcsfbsbvbm04sk
Fixup tests broken by cleaning up the layering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
from bzrlib.workingtree import WorkingTree
39
39
 
40
40
# These tests are a bit old; please instead add new tests into
41
 
# per_interrepository/ so they'll run on all relevant
 
41
# interrepository_implementations/ so they'll run on all relevant
42
42
# combinations.
43
43
 
44
44
 
95
95
    br_a3.fetch(br_a2, br_a.revision_history()[2])
96
96
    # pull the 3 revisions introduced by a@u-0-3
97
97
    br_a3.fetch(br_a2, br_a.revision_history()[3])
98
 
    # NoSuchRevision should be raised if the branch is missing the revision
 
98
    # InstallFailed should be raised if the branch is missing the revision
99
99
    # that was requested.
100
 
    self.assertRaises(errors.NoSuchRevision, br_a3.fetch, br_a2, 'pizza')
 
100
    self.assertRaises(errors.InstallFailed, br_a3.fetch, br_a2, 'pizza')
101
101
 
102
102
    # TODO: Test trying to fetch from a branch that points to a revision not
103
103
    # actually present in its repository.  Not every branch format allows you
321
321
        self.assertEqual(1, self._count_log_matches('branch/format', http_logs))
322
322
        self.assertEqual(1, self._count_log_matches('repository/format',
323
323
            http_logs))
324
 
        self.assertEqual(1, self._count_log_matches('revisions.kndx',
325
 
            http_logs))
326
324
        self.assertTrue(1 >= self._count_log_matches('revision-history',
327
325
                                                     http_logs))
328
326
        self.assertTrue(1 >= self._count_log_matches('last-revision',
329
327
                                                     http_logs))
330
 
        self.assertLength(5, http_logs)
 
328
        self.assertEqual(4, len(http_logs))
331
329
 
332
330
 
333
331
class TestKnitToPackFetch(TestCaseWithTransport):
404
402
        source.inventories = versionedfile.RecordingVersionedFilesDecorator(
405
403
                        source.inventories)
406
404
        # XXX: This won't work in general, but for the dirstate format it does.
407
 
        self.overrideAttr(target._format, '_fetch_uses_deltas', False)
 
405
        old_fetch_uses_deltas_setting = target._format._fetch_uses_deltas
 
406
        def restore():
 
407
            target._format._fetch_uses_deltas = old_fetch_uses_deltas_setting
 
408
        self.addCleanup(restore)
 
409
        target._format._fetch_uses_deltas = False
408
410
        target.fetch(source, revision_id='rev-one')
409
411
        self.assertEqual(('get_record_stream', [('file-id', 'rev-one')],
410
412
                          target._format._fetch_order, True),
574
576
        self.repo.fetch(self.tree.branch.repository, 'second-id')
575
577
        root_id = self.tree.get_root_id()
576
578
        self.assertEqual(
577
 
            ((root_id, 'left-parent'), (root_id, 'not-ghost-parent')),
 
579
            ((root_id, 'left-parent'), (root_id, 'ghost-parent'),
 
580
             (root_id, 'not-ghost-parent')),
578
581
            self.get_parents(root_id, 'second-id'))
579
582
 
580
583
    def make_two_commits(self, change_root, fetch_twice):