/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/interrepository_implementations/test_interrepository.py

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
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
29
29
                           NotBranchError,
30
30
                           )
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
97
98
    raise
98
99
 
99
100
 
 
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__)
 
108
 
 
109
 
100
110
class TestInterRepository(TestCaseWithInterRepository):
101
111
 
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__)
 
116
        #
 
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.
 
120
        # mbp 20070206
 
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__)
 
125
        pass
110
126
 
111
127
    def test_fetch(self):
112
128
        tree_a = self.make_branch_and_tree('a')
182
198
 
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')