~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/__init__.py

Merge bzr.dev, update to use new hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010 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; either version 2 of the License, or
 
6
# (at your option) any 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
"""Weave formats.
 
18
 
 
19
These were formats present in pre-1.0 version of Bazaar.
 
20
"""
 
21
 
 
22
# Since we are a built-in plugin we share the bzrlib version
 
23
from bzrlib import version_info
 
24
 
 
25
from bzrlib import (
 
26
    branch as _mod_branch,
 
27
    controldir,
 
28
    repository as _mod_repository,
 
29
    serializer,
 
30
    workingtree as _mod_workingtree,
 
31
    )
 
32
from bzrlib.bzrdir import (
 
33
    BzrProber,
 
34
    register_metadir,
 
35
    )
 
36
 
 
37
# Pre-0.8 formats that don't have a disk format string (because they are
 
38
# versioned by the matching control directory). We use the control directories
 
39
# disk format string as a key for the network_name because they meet the
 
40
# constraints (simple string, unique, immutable).
 
41
_mod_repository.network_format_registry.register_lazy(
 
42
    "Bazaar-NG branch, format 5\n",
 
43
    'bzrlib.plugins.weave_fmt.repository',
 
44
    'RepositoryFormat5',
 
45
)
 
46
_mod_repository.network_format_registry.register_lazy(
 
47
    "Bazaar-NG branch, format 6\n",
 
48
    'bzrlib.plugins.weave_fmt.repository',
 
49
    'RepositoryFormat6',
 
50
)
 
51
 
 
52
# weave formats which has no format string and are not discoverable or independently
 
53
# creatable on disk, so are not registered in format_registry.  They're
 
54
# all in bzrlib.plugins.weave_fmt.repository now.  When an instance of one of these is
 
55
# needed, it's constructed directly by the BzrDir.  Non-native formats where
 
56
# the repository is not separately opened are similar.
 
57
 
 
58
_mod_repository.format_registry.register_lazy(
 
59
    'Bazaar-NG Repository format 7',
 
60
    'bzrlib.plugins.weave_fmt.repository',
 
61
    'RepositoryFormat7'
 
62
    )
 
63
 
 
64
_mod_repository.format_registry.register_extra_lazy(
 
65
    'bzrlib.plugins.weave_fmt.repository',
 
66
    'RepositoryFormat4')
 
67
_mod_repository.format_registry.register_extra_lazy(
 
68
    'bzrlib.plugins.weave_fmt.repository',
 
69
    'RepositoryFormat5')
 
70
_mod_repository.format_registry.register_extra_lazy(
 
71
    'bzrlib.plugins.weave_fmt.repository',
 
72
    'RepositoryFormat6')
 
73
 
 
74
 
 
75
# The pre-0.8 formats have their repository format network name registered in
 
76
# repository.py. MetaDir formats have their repository format network name
 
77
# inferred from their disk format string.
 
78
controldir.format_registry.register_lazy('weave',
 
79
    "bzrlib.plugins.weave_fmt.bzrdir", "BzrDirFormat6",
 
80
    'Pre-0.8 format.  Slower than knit and does not'
 
81
    ' support checkouts or shared repositories.',
 
82
    hidden=True,
 
83
    deprecated=True)
 
84
register_metadir(controldir.format_registry, 'metaweave',
 
85
    'bzrlib.plugins.weave_fmt.repository.RepositoryFormat7',
 
86
    'Transitional format in 0.8.  Slower than knit.',
 
87
    branch_format='bzrlib.branch.BzrBranchFormat5',
 
88
    tree_format='bzrlib.workingtree_3.WorkingTreeFormat3',
 
89
    hidden=True,
 
90
    deprecated=True)
 
91
 
 
92
 
 
93
BzrProber.formats.register_lazy(
 
94
    "Bazaar-NG branch, format 0.0.4\n", "bzrlib.plugins.weave_fmt.bzrdir",
 
95
    "BzrDirFormat4")
 
96
BzrProber.formats.register_lazy(
 
97
    "Bazaar-NG branch, format 5\n", "bzrlib.plugins.weave_fmt.bzrdir",
 
98
    "BzrDirFormat5")
 
99
BzrProber.formats.register_lazy(
 
100
    "Bazaar-NG branch, format 6\n", "bzrlib.plugins.weave_fmt.bzrdir",
 
101
    "BzrDirFormat6")
 
102
 
 
103
 
 
104
_mod_branch.format_registry.register_extra_lazy(
 
105
    'bzrlib.plugins.weave_fmt.branch', 'BzrBranchFormat4')
 
106
_mod_branch.network_format_registry.register_lazy(
 
107
    "Bazaar-NG branch, format 6\n",
 
108
    'bzrlib.plugins.weave_fmt.branch', "BzrBranchFormat4")
 
109
 
 
110
 
 
111
_mod_workingtree.format_registry.register_extra_lazy(
 
112
    'bzrlib.plugins.weave_fmt.workingtree',
 
113
    'WorkingTreeFormat2')
 
114
 
 
115
serializer.format_registry.register_lazy('4', 'bzrlib.plugins.weave_fmt.xml4',
 
116
    'serializer_v4')
 
117
 
 
118
def load_tests(basic_tests, module, loader):
 
119
    testmod_names = [
 
120
        'test_bzrdir',
 
121
        'test_repository',
 
122
        'test_workingtree',
 
123
        ]
 
124
    basic_tests.addTest(loader.loadTestsFromModuleNames(
 
125
            ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
 
126
    return basic_tests