/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 breezy/plugins/darcs/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2017-09-02 23:28:59 UTC
  • mfrom: (6777.1.1 merge-darcs)
  • Revision ID: jelmer@jelmer.uk-20170902232859-o6b2bs0d0ribexwy
Merge lp:~jelmer/brz/bundle-darcs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
# the Free Software Foundation; version 3 of the License or 
 
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
 
 
22
from __future__ import absolute_import
 
23
 
 
24
from breezy import (
 
25
    controldir,
 
26
    errors,
 
27
    )
 
28
 
 
29
 
 
30
class DarcsDirFormat(controldir.ControlDirFormat):
 
31
    """Darcs directory format."""
 
32
 
 
33
    def get_converter(self):
 
34
        raise NotImplementedError(self.get_converter)
 
35
 
 
36
    def get_format_description(self):
 
37
        return "darcs control directory"
 
38
 
 
39
    def initialize_on_transport(self, transport):
 
40
        raise NotImplementedError(self.get_converter)
 
41
 
 
42
    @classmethod
 
43
    def _known_formats(self):
 
44
        return set([DarcsDirFormat()])
 
45
 
 
46
    def open(self, transport, _found=False):
 
47
        """Open this directory."""
 
48
        raise errors.BzrCommandError(
 
49
            'Darcs branches are not yet supported. '
 
50
            'To convert darcs branches to Bazaar branches or vice versa, '
 
51
            'use bzr-fastimport. See http://bazaar-vcs.org/BzrMigration.')
 
52
 
 
53
    @classmethod
 
54
    def probe_transport(klass, transport):
 
55
        """Our format is present if the transport has a '_darcs/' subdir."""
 
56
        format = klass()
 
57
        if transport.has('_darcs'):
 
58
            return format
 
59
        raise errors.NotBranchError(path=transport.base)
 
60
 
 
61
 
 
62
controldir.ControlDirFormat.register_control_format(DarcsDirFormat)