30
30
import bzrlib.repository as repository
31
from bzrlib.revision import NULL_REVISION
31
from bzrlib.revision import NULL_REVISION, Revision
32
32
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
33
33
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
34
34
from bzrlib.transport import get_transport
58
58
format = self.repository_format._matchingbzrdir
59
59
return format.initialize(url)
60
60
except UninitializableFormat:
61
raise TestSkipped("Format %s is not initializable.")
61
raise TestSkipped("Format %s is not initializable." % format)
63
63
def make_repository(self, relpath, format=None):
64
64
made_control = self.make_bzrdir(relpath, format=format)
119
119
repo_b = repository.Repository.open('.')
120
120
repo_a.fetch(repo_b)
122
def test_fetch_missing_text_other_location_fails(self):
123
source_tree = self.make_branch_and_tree('source')
124
source = source_tree.branch.repository
125
target = self.make_to_repository('target')
127
# start by adding a file so the data for hte file exists.
128
self.build_tree(['source/id'])
129
source_tree.add(['id'], ['id'])
130
source_tree.commit('a', rev_id='a')
131
# now we manually insert a revision with an inventory referencing
132
# 'id' at revision 'b', but we do not insert revision b.
133
# this should ensure that the new versions of files are being checked
134
# for during pull operations
135
inv = source.get_inventory('a')
136
inv['id'].revision = 'b'
137
sha1 = source.add_inventory('b', inv, ['a'])
138
rev = Revision(timestamp=0,
140
committer="Foo Bar <foo@example.com>",
144
rev.parent_ids = ['a']
145
source.add_revision('b', rev)
146
self.assertRaises(errors.RevisionNotPresent, target.fetch, source)
147
self.assertFalse(target.has_revision('b'))
123
150
class TestCaseWithComplexRepository(TestCaseWithInterRepository):