/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: Canonical.com Patch Queue Manager
  • Date: 2009-10-14 07:53:41 UTC
  • mfrom: (4739.3.1 fix-diff-docstring)
  • Revision ID: pqm@pqm.ubuntu.com-20091014075341-xjtgl5ji20autac6
(jml) Bring docstring of bzrlib.diff.get_trees_and_branches_to_diff
        up to date with recent changes.

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
74
74
        self.mapping_registry = DummyForeignVcsMappingRegistry()
75
75
        self.mapping_registry.register("v1", DummyForeignVcsMapping(self),
76
76
                                       "Version 1")
77
 
        self.abbreviation = "dummy"
78
77
 
79
78
    def show_foreign_revid(self, foreign_revid):
80
79
        return { "dummy ding": "%s/%s\\%s" % foreign_revid }
81
80
 
82
 
    def serialize_foreign_revid(self, foreign_revid):
83
 
        return "%s|%s|%s" % foreign_revid
84
 
 
85
81
 
86
82
class DummyForeignVcsBranch(branch.BzrBranch6,foreign.ForeignBranch):
87
83
    """A Dummy VCS Branch."""
90
86
        self._format = _format
91
87
        self._base = a_bzrdir.transport.base
92
88
        self._ignore_fallbacks = False
93
 
        self.bzrdir = a_bzrdir
94
89
        foreign.ForeignBranch.__init__(self, 
95
90
            DummyForeignVcsMapping(DummyForeignVcs()))
96
91
        branch.BzrBranch6.__init__(self, _format, _control_files, a_bzrdir, 
104
99
    def is_compatible(source, target):
105
100
        return isinstance(target, DummyForeignVcsBranch)
106
101
 
107
 
    def push(self, overwrite=False, stop_revision=None):
108
 
        raise errors.NoRoundtrippingSupport(self.source, self.target)
109
 
 
110
102
    def lossy_push(self, stop_revision=None):
111
103
        result = branch.BranchPushResult()
112
104
        result.source_branch = self.source
172
164
        super(DummyForeignVcsBranchFormat, self).__init__()
173
165
        self._matchingbzrdir = DummyForeignVcsDirFormat()
174
166
 
175
 
    def open(self, a_bzrdir, name=None, _found=False):
 
167
    def open(self, a_bzrdir, _found=False):
176
168
        if not _found:
177
169
            raise NotImplementedError
178
170
        try:
179
 
            transport = a_bzrdir.get_branch_transport(None, name=name)
 
171
            transport = a_bzrdir.get_branch_transport(None)
180
172
            control_files = lockable_files.LockableFiles(transport, 'lock',
181
173
                                                         lockdir.LockDir)
182
174
            return DummyForeignVcsBranch(_format=self,
244
236
        self._control_files = lockable_files.LockableFiles(self.transport,
245
237
            "lock", lockable_files.TransportLock)
246
238
 
247
 
    def open_branch(self, name=None, unsupported=False, ignore_fallbacks=True):
248
 
        if name is not None:
249
 
            raise errors.NoColocatedBranchSupport(self)
 
239
    def open_branch(self, ignore_fallbacks=True):
250
240
        return self._format.get_branch_format().open(self, _found=True)
251
241
 
252
242
    def cloning_metadir(self, stacked=False):
357
347
        self.assertNotEquals("A Dummy VCS Dir",
358
348
                             newdir._format.get_format_string())
359
349
 
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
350
    def test_lossy_push_empty(self):
368
351
        source_tree = self.make_branch_and_tree("source")
369
352
        target_tree = self.make_branch_and_tree("target",