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 |
||
|
7290.33.2
by Jelmer Vernooij
Add version_info to some plugins. |
22 |
from ... import version_info # noqa: F401 |
|
6777.1.1
by Jelmer Vernooij
Bundle the darcs plugin. |
23 |
from breezy import ( |
24 |
controldir, |
|
|
0.197.1
by Jelmer Vernooij
Add trivial bzr-darcs plugin. |
25 |
errors, |
26 |
)
|
|
27 |
||
28 |
||
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
29 |
class DarcsUnsupportedError(errors.UnsupportedFormatError): |
30 |
||
31 |
_fmt = ('Darcs branches are not yet supported. ' |
|
|
7490.113.1
by Jelmer Vernooij
Don't reference Bazaar in message suggesting fsatimports. |
32 |
'To interoperate with darcs branches, use fastimport.') |
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
33 |
|
34 |
||
|
6777.1.1
by Jelmer Vernooij
Bundle the darcs plugin. |
35 |
class DarcsDirFormat(controldir.ControlDirFormat): |
|
0.197.1
by Jelmer Vernooij
Add trivial bzr-darcs plugin. |
36 |
"""Darcs directory format.""" |
37 |
||
38 |
def get_converter(self): |
|
39 |
raise NotImplementedError(self.get_converter) |
|
40 |
||
41 |
def get_format_description(self): |
|
42 |
return "darcs control directory" |
|
43 |
||
44 |
def initialize_on_transport(self, transport): |
|
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
45 |
raise errors.UninitializableFormat(self) |
46 |
||
47 |
def is_supported(self): |
|
48 |
return False |
|
49 |
||
50 |
def supports_transport(self, transport): |
|
51 |
return False |
|
|
0.197.1
by Jelmer Vernooij
Add trivial bzr-darcs plugin. |
52 |
|
53 |
@classmethod
|
|
54 |
def _known_formats(self): |
|
55 |
return set([DarcsDirFormat()]) |
|
56 |
||
57 |
def open(self, transport, _found=False): |
|
58 |
"""Open this directory.""" |
|
|
7490.20.1
by Jelmer Vernooij
Fix darcs repository detection. |
59 |
raise DarcsUnsupportedError() |
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
60 |
|
61 |
def check_support_status(self, allow_unsupported, recommend_upgrade=True, |
|
62 |
basedir=None): |
|
|
7490.20.1
by Jelmer Vernooij
Fix darcs repository detection. |
63 |
raise DarcsUnsupportedError() |
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
64 |
|
65 |
def open(self, transport): |
|
66 |
# Raise NotBranchError if there is nothing there
|
|
67 |
DarcsProber().probe_transport(transport) |
|
68 |
raise NotImplementedError(self.open) |
|
69 |
||
70 |
||
71 |
class DarcsProber(controldir.Prober): |
|
|
0.197.1
by Jelmer Vernooij
Add trivial bzr-darcs plugin. |
72 |
|
73 |
@classmethod
|
|
|
7413.6.1
by Jelmer Vernooij
Add an optional priority field for probers. |
74 |
def priority(klass, transport): |
|
7490.21.1
by Jelmer Vernooij
Prioritize likely darcs hosts for darcs repositories. |
75 |
if 'darcs' in transport.base: |
76 |
return 90 |
|
|
7413.6.1
by Jelmer Vernooij
Add an optional priority field for probers. |
77 |
return 100 |
78 |
||
79 |
@classmethod
|
|
|
0.197.1
by Jelmer Vernooij
Add trivial bzr-darcs plugin. |
80 |
def probe_transport(klass, transport): |
|
7490.89.1
by Jelmer Vernooij
Check for inventory files when opening darcs repositories. |
81 |
if transport.has_any(['_darcs/format', '_darcs/inventory']): |
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
82 |
return DarcsDirFormat() |
|
0.197.1
by Jelmer Vernooij
Add trivial bzr-darcs plugin. |
83 |
raise errors.NotBranchError(path=transport.base) |
84 |
||
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
85 |
@classmethod
|
86 |
def known_formats(cls): |
|
|
6973.12.9
by Jelmer Vernooij
More fixes. |
87 |
return [DarcsDirFormat()] |
|
6786.1.1
by Jelmer Vernooij
Use modern prober for darcs plugin. |
88 |
|
89 |
||
90 |
controldir.ControlDirFormat.register_prober(DarcsProber) |