/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/cvs/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2017-09-01 05:13:11 UTC
  • mfrom: (6652.2.10 warn-mtn-cvs)
  • Revision ID: jelmer@jelmer.uk-20170901051311-m2ru9ao055fmc5l9
Merge lp:~jelmer/brz/warn-mtn-cvs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2008 Canonical Ltd
 
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 2 of the License.
 
6
#
 
7
# This program is distributed in the hope that it will be useful,
 
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
# GNU General Public License for more details.
 
11
#
 
12
# You should have received a copy of the GNU General Public License
 
13
# along with this program; if not, write to the Free Software
 
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
 
 
16
 
 
17
"""CVS working tree support for bzr.
 
18
 
 
19
Currently limited to referencing tools for migration.
 
20
"""
 
21
 
 
22
from __future__ import absolute_import
 
23
 
 
24
from ... import version_info
 
25
 
 
26
from ... import (
 
27
    controldir,
 
28
    errors,
 
29
    )
 
30
 
 
31
 
 
32
class CVSUnsupportedError(errors.UnsupportedFormatError):
 
33
 
 
34
    _fmt = ("CVS working trees are not supported. To convert CVS projects to "
 
35
            "bzr, please see http://bazaar-vcs.org/BzrMigration and/or "
 
36
            "https://launchpad.net/launchpad-bazaar/+faq/26.")
 
37
 
 
38
 
 
39
class CVSDirFormat(controldir.ControlDirFormat):
 
40
    """The CVS directory control format."""
 
41
 
 
42
    def get_converter(self):
 
43
        raise NotImplementedError(self.get_converter)
 
44
 
 
45
    def get_format_description(self):
 
46
        return "CVS control directory."
 
47
 
 
48
    def initialize_on_transport(self, transport):
 
49
        raise errors.UninitializableFormat(self)
 
50
 
 
51
    def is_supported(self):
 
52
        return False
 
53
 
 
54
    def supports_transport(self, transport):
 
55
        return False
 
56
 
 
57
    def check_support_status(self, allow_unsupported, recommend_upgrade=True,
 
58
           basedir=None):
 
59
        raise CVSUnsupportedError(self)
 
60
 
 
61
    def open(self, transport):
 
62
        # Raise NotBranchError if there is nothing there
 
63
        CVSProber().probe_transport(transport)
 
64
        raise NotImplementedError(self.open)
 
65
 
 
66
 
 
67
class CVSProber(controldir.Prober):
 
68
 
 
69
    @classmethod
 
70
    def probe_transport(klass, transport):
 
71
        # little ugly, but works
 
72
        # try a manual probe first, its a little faster perhaps ?
 
73
        if transport.has('CVS') and transport.has('CVS/Repository'):
 
74
            return CVSDirFormat()
 
75
        raise errors.NotBranchError(path=transport.base)
 
76
 
 
77
    @classmethod
 
78
    def known_formats(cls):
 
79
        return set([CVSDirFormat()])
 
80
 
 
81
 
 
82
controldir.ControlDirFormat.register_prober(CVSProber)