/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
1
# Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
7143.15.2 by Jelmer Vernooij
Run autopep8.
5
# the Free Software Foundation; version 3 of the License or
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
6
# (at your option) a later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
"""Darcs foreign branch support.
18
19
Currently only tells the user to use fastimport/fastexport.
20
"""
21
6780 by Jelmer Vernooij
Merge lp:~jelmer/brz/bundle-darcs.
22
from __future__ import absolute_import
23
6777.1.1 by Jelmer Vernooij
Bundle the darcs plugin.
24
from breezy import (
25
    controldir,
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
26
    errors,
27
    )
28
29
6786.1.1 by Jelmer Vernooij
Use modern prober for darcs plugin.
30
class DarcsUnsupportedError(errors.UnsupportedFormatError):
31
32
    _fmt = ('Darcs branches are not yet supported. '
33
            'To convert darcs branches to Bazaar branches or vice versa, '
34
            'use bzr-fastimport. See http://bazaar-vcs.org/BzrMigration.')
35
36
6777.1.1 by Jelmer Vernooij
Bundle the darcs plugin.
37
class DarcsDirFormat(controldir.ControlDirFormat):
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
38
    """Darcs directory format."""
39
40
    def get_converter(self):
41
        raise NotImplementedError(self.get_converter)
42
43
    def get_format_description(self):
44
        return "darcs control directory"
45
46
    def initialize_on_transport(self, transport):
6786.1.1 by Jelmer Vernooij
Use modern prober for darcs plugin.
47
        raise errors.UninitializableFormat(self)
48
49
    def is_supported(self):
50
        return False
51
52
    def supports_transport(self, transport):
53
        return False
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
54
55
    @classmethod
56
    def _known_formats(self):
57
        return set([DarcsDirFormat()])
58
59
    def open(self, transport, _found=False):
60
        """Open this directory."""
6786.1.1 by Jelmer Vernooij
Use modern prober for darcs plugin.
61
        raise DarcsUnsupportedError(self)
62
63
    def check_support_status(self, allow_unsupported, recommend_upgrade=True,
64
                             basedir=None):
65
        raise DarcsUnsupportedError(self)
66
67
    def open(self, transport):
68
        # Raise NotBranchError if there is nothing there
69
        DarcsProber().probe_transport(transport)
70
        raise NotImplementedError(self.open)
71
72
73
class DarcsProber(controldir.Prober):
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
74
75
    @classmethod
76
    def probe_transport(klass, transport):
77
        if transport.has('_darcs'):
6786.1.1 by Jelmer Vernooij
Use modern prober for darcs plugin.
78
            return DarcsDirFormat()
0.197.1 by Jelmer Vernooij
Add trivial bzr-darcs plugin.
79
        raise errors.NotBranchError(path=transport.base)
80
6786.1.1 by Jelmer Vernooij
Use modern prober for darcs plugin.
81
    @classmethod
82
    def known_formats(cls):
6973.12.9 by Jelmer Vernooij
More fixes.
83
        return [DarcsDirFormat()]
6786.1.1 by Jelmer Vernooij
Use modern prober for darcs plugin.
84
85
86
controldir.ControlDirFormat.register_prober(DarcsProber)