/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: Jelmer Vernooij
  • Date: 2010-03-21 21:39:33 UTC
  • mfrom: (5102 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5143.
  • Revision ID: jelmer@samba.org-20100321213933-fexeh9zcoz8oaju2
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

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