1
# (C) 2005, 2006 Canonical Ltd
1
# Copyright (C) 2005, 2006 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
31
31
from bzrlib.inventory import Inventory
32
import bzrlib.repofmt.weaverepo as weaverepo
32
33
import bzrlib.repository as repository
33
34
from bzrlib.revision import NULL_REVISION, Revision
34
35
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
101
def check_repo_format_for_funky_id_on_win32(repo):
102
if (isinstance(repo, (weaverepo.AllInOneRepository,
103
weaverepo.WeaveMetaDirRepository))
104
and sys.platform == 'win32'):
105
raise TestSkipped("funky chars does not permitted"
106
" on this platform in repository"
107
" %s" % repo.__class__.__name__)
100
110
class TestInterRepository(TestCaseWithInterRepository):
102
112
def test_interrepository_get_returns_correct_optimiser(self):
103
113
# we assume the optimising code paths are triggered
104
114
# by the type of the repo not the transport - at this point.
105
115
# we may need to update this test if this changes.
106
source_repo = self.make_repository("source")
107
target_repo = self.make_to_repository("target")
108
interrepo = repository.InterRepository.get(source_repo, target_repo)
109
self.assertEqual(self.interrepo_class, interrepo.__class__)
117
# XXX: This code tests that we get an InterRepository when we try to
118
# convert between the two repositories that it wants to be tested with
119
# -- but that's not necessarily correct. So for now this is disabled.
121
## source_repo = self.make_repository("source")
122
## target_repo = self.make_to_repository("target")
123
## interrepo = repository.InterRepository.get(source_repo, target_repo)
124
## self.assertEqual(self.interrepo_class, interrepo.__class__)
111
127
def test_fetch(self):
112
128
tree_a = self.make_branch_and_tree('a')
183
199
def test_fetch_funky_file_id(self):
184
200
from_tree = self.make_branch_and_tree('tree')
201
if sys.platform == 'win32':
202
from_repo = from_tree.branch.repository
203
check_repo_format_for_funky_id_on_win32(from_repo)
185
204
self.build_tree(['tree/filename'])
186
205
from_tree.add('filename', 'funky-chars<>%&;"\'')
187
206
from_tree.commit('commit filename')
191
210
def test_fetch_no_inventory_revision(self):
192
211
"""Old inventories lack revision_ids, so simulate this"""
193
212
from_tree = self.make_branch_and_tree('tree')
213
if sys.platform == 'win32':
214
from_repo = from_tree.branch.repository
215
check_repo_format_for_funky_id_on_win32(from_repo)
194
216
self.build_tree(['tree/filename'])
195
217
from_tree.add('filename', 'funky-chars<>%&;"\'')
196
218
from_tree.commit('commit filename')