/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/test_foreign.py

  • Committer: Martin Pool
  • Date: 2009-12-10 00:13:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4884.
  • Revision ID: mbp@sourcefrog.net-20091210001316-w1l2jtek6v8iyg49
Mention GNU project in --version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008 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
90
90
        self._format = _format
91
91
        self._base = a_bzrdir.transport.base
92
92
        self._ignore_fallbacks = False
93
 
        self.bzrdir = a_bzrdir
94
93
        foreign.ForeignBranch.__init__(self, 
95
94
            DummyForeignVcsMapping(DummyForeignVcs()))
96
95
        branch.BzrBranch6.__init__(self, _format, _control_files, a_bzrdir, 
104
103
    def is_compatible(source, target):
105
104
        return isinstance(target, DummyForeignVcsBranch)
106
105
 
107
 
    def push(self, overwrite=False, stop_revision=None):
108
 
        raise errors.NoRoundtrippingSupport(self.source, self.target)
109
 
 
110
106
    def lossy_push(self, stop_revision=None):
111
107
        result = branch.BranchPushResult()
112
108
        result.source_branch = self.source
172
168
        super(DummyForeignVcsBranchFormat, self).__init__()
173
169
        self._matchingbzrdir = DummyForeignVcsDirFormat()
174
170
 
175
 
    def open(self, a_bzrdir, name=None, _found=False):
 
171
    def open(self, a_bzrdir, _found=False):
176
172
        if not _found:
177
173
            raise NotImplementedError
178
174
        try:
179
 
            transport = a_bzrdir.get_branch_transport(None, name=name)
 
175
            transport = a_bzrdir.get_branch_transport(None)
180
176
            control_files = lockable_files.LockableFiles(transport, 'lock',
181
177
                                                         lockdir.LockDir)
182
178
            return DummyForeignVcsBranch(_format=self,
244
240
        self._control_files = lockable_files.LockableFiles(self.transport,
245
241
            "lock", lockable_files.TransportLock)
246
242
 
247
 
    def open_branch(self, name=None, unsupported=False, ignore_fallbacks=True):
248
 
        if name is not None:
249
 
            raise errors.NoColocatedBranchSupport(self)
 
243
    def open_branch(self, ignore_fallbacks=True):
250
244
        return self._format.get_branch_format().open(self, _found=True)
251
245
 
252
246
    def cloning_metadir(self, stacked=False):
357
351
        self.assertNotEquals("A Dummy VCS Dir",
358
352
                             newdir._format.get_format_string())
359
353
 
360
 
    def test_push_not_supported(self):
361
 
        source_tree = self.make_branch_and_tree("source")
362
 
        target_tree = self.make_branch_and_tree("target", 
363
 
            format=DummyForeignVcsDirFormat())
364
 
        self.assertRaises(errors.NoRoundtrippingSupport, 
365
 
            source_tree.branch.push, target_tree.branch)
366
 
 
367
354
    def test_lossy_push_empty(self):
368
355
        source_tree = self.make_branch_and_tree("source")
369
356
        target_tree = self.make_branch_and_tree("target",