1
# Copyright (C) 2005 Canonical Ltd
1
# Copyright (C) 2005, 2007 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
27
28
from bzrlib.branch import Branch
28
29
from bzrlib.bzrdir import BzrDir
30
30
from bzrlib.repofmt import knitrepo
31
from bzrlib.symbol_versioning import (
31
34
from bzrlib.tests import TestCaseWithTransport
32
35
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
33
36
from bzrlib.tests.test_revision import make_branches
35
38
from bzrlib.upgrade import Convert
36
39
from bzrlib.workingtree import WorkingTree
41
# These tests are a bit old; please instead add new tests into
42
# interrepository_implementations/ so they'll run on all relevant
39
46
def has_revision(branch, revision_id):
40
47
return branch.repository.has_revision(revision_id)
94
101
self.assertEquals(fetched, 3, "fetched %d instead of 3" % fetched)
95
102
# InstallFailed should be raised if the branch is missing the revision
96
103
# that was requested.
97
self.assertRaises(bzrlib.errors.InstallFailed, br_a3.fetch, br_a2, 'pizza')
98
# InstallFailed should be raised if the branch is missing a revision
99
# from its own revision history
100
br_a2.append_revision('a-b-c')
101
self.assertRaises(bzrlib.errors.InstallFailed, br_a3.fetch, br_a2)
104
self.assertRaises(errors.InstallFailed, br_a3.fetch, br_a2, 'pizza')
103
# TODO: ADHB 20070116 Perhaps set_last_revision shouldn't accept
104
# revisions which are not present? In that case, this test
107
# RBC 20060403 the way to do this is to uncommit the revision from
108
# the repository after the commit
106
# TODO: Test trying to fetch from a branch that points to a revision not
107
# actually present in its repository. Not every branch format allows you
108
# to directly point to such revisions, so it's a bit complicated to
109
# construct. One way would be to uncommit and gc the revision, but not
110
# every branch supports that. -- mbp 20070814
110
112
#TODO: test that fetch correctly does reweaving when needed. RBC 20051008
111
113
# Note that this means - updating the weave when ghosts are filled in to
117
119
def test_fetch(self):
118
120
#highest indices a: 5, b: 7
119
br_a, br_b = make_branches(self)
121
br_a, br_b = make_branches(self, format='dirstate-tags')
120
122
fetch_steps(self, br_a, br_b, br_a)
122
124
def test_fetch_self(self):