/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
1
# Copyright (C) 2011, 2012, 2016 Canonical Ltd
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
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
"""Tests for the weave-era BzrDir formats.
18
19
For interface contract tests, see tests/per_bzr_dir.
20
"""
21
6379.6.7 by Jelmer Vernooij
Move importing from future until after doc string, otherwise the doc string will disappear.
22
from __future__ import absolute_import
23
5582.10.91 by Jelmer Vernooij
Fix some tests.
24
import os
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
25
import sys
26
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
27
from ... import (
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
28
    branch,
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
29
    controldir,
5582.10.91 by Jelmer Vernooij
Fix some tests.
30
    errors,
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
31
    repository,
32
    upgrade,
5582.10.91 by Jelmer Vernooij
Fix some tests.
33
    urlutils,
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
34
    workingtree,
35
    )
6670.4.12 by Jelmer Vernooij
Move inventorytree to breezy.bzr.
36
from ...bzr import (
37
    bzrdir,
38
    )
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
39
from ...osutils import (
5582.10.91 by Jelmer Vernooij
Fix some tests.
40
    getcwd,
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
41
    )
6710.1.1 by Jelmer Vernooij
Don't import V4BundleTester directly, but via a module import.
42
from ...tests import test_bundle
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
43
from ...tests.test_sftp_transport import TestCaseWithSFTPServer
44
from ...tests import (
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
45
    TestCaseWithTransport,
46
    )
47
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
48
from .branch import (
5582.10.91 by Jelmer Vernooij
Fix some tests.
49
    BzrBranchFormat4,
50
    )
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
51
from .bzrdir import (
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
52
    BzrDirFormat5,
53
    BzrDirFormat6,
54
    )
55
56
57
class TestFormat5(TestCaseWithTransport):
58
    """Tests specific to the version 5 bzrdir format."""
59
60
    def test_same_lockfiles_between_tree_repo_branch(self):
61
        # this checks that only a single lockfiles instance is created
62
        # for format 5 objects
63
        dir = BzrDirFormat5().initialize(self.get_url())
64
        def check_dir_components_use_same_lock(dir):
65
            ctrl_1 = dir.open_repository().control_files
66
            ctrl_2 = dir.open_branch().control_files
67
            ctrl_3 = dir.open_workingtree()._control_files
68
            self.assertTrue(ctrl_1 is ctrl_2)
69
            self.assertTrue(ctrl_2 is ctrl_3)
70
        check_dir_components_use_same_lock(dir)
71
        # and if we open it normally.
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
72
        dir = controldir.ControlDir.open(self.get_url())
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
73
        check_dir_components_use_same_lock(dir)
74
75
    def test_can_convert(self):
76
        # format 5 dirs are convertable
77
        dir = BzrDirFormat5().initialize(self.get_url())
78
        self.assertTrue(dir.can_convert_format())
79
80
    def test_needs_conversion(self):
81
        # format 5 dirs need a conversion if they are not the default,
82
        # and they aren't
83
        dir = BzrDirFormat5().initialize(self.get_url())
84
        # don't need to convert it to itself
85
        self.assertFalse(dir.needs_format_conversion(BzrDirFormat5()))
86
        # do need to convert it to the current default
87
        self.assertTrue(dir.needs_format_conversion(
88
            bzrdir.BzrDirFormat.get_default_format()))
89
90
91
class TestFormat6(TestCaseWithTransport):
92
    """Tests specific to the version 6 bzrdir format."""
93
94
    def test_same_lockfiles_between_tree_repo_branch(self):
95
        # this checks that only a single lockfiles instance is created
96
        # for format 6 objects
97
        dir = BzrDirFormat6().initialize(self.get_url())
98
        def check_dir_components_use_same_lock(dir):
99
            ctrl_1 = dir.open_repository().control_files
100
            ctrl_2 = dir.open_branch().control_files
101
            ctrl_3 = dir.open_workingtree()._control_files
102
            self.assertTrue(ctrl_1 is ctrl_2)
103
            self.assertTrue(ctrl_2 is ctrl_3)
104
        check_dir_components_use_same_lock(dir)
105
        # and if we open it normally.
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
106
        dir = controldir.ControlDir.open(self.get_url())
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
107
        check_dir_components_use_same_lock(dir)
108
109
    def test_can_convert(self):
110
        # format 6 dirs are convertable
111
        dir = BzrDirFormat6().initialize(self.get_url())
112
        self.assertTrue(dir.can_convert_format())
113
114
    def test_needs_conversion(self):
115
        # format 6 dirs need an conversion if they are not the default.
116
        dir = BzrDirFormat6().initialize(self.get_url())
117
        self.assertTrue(dir.needs_format_conversion(
118
            bzrdir.BzrDirFormat.get_default_format()))
119
120
121
class TestBreakLockOldBranch(TestCaseWithTransport):
122
123
    def test_break_lock_format_5_bzrdir(self):
124
        # break lock on a format 5 bzrdir should just return
125
        self.make_branch_and_tree('foo', format=BzrDirFormat5())
126
        out, err = self.run_bzr('break-lock foo')
127
        self.assertEqual('', out)
128
        self.assertEqual('', err)
129
130
131
_upgrade1_template = \
132
     [
6855.4.1 by Jelmer Vernooij
Yet more bees.
133
     ('foo', b'new contents\n'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
134
     ('.bzr/',),
135
     ('.bzr/README',
6855.4.1 by Jelmer Vernooij
Yet more bees.
136
      b'This is a Bazaar control directory.\n'
137
      b'Do not change any files in this directory.\n'
138
      b'See http://bazaar.canonical.com/ for more information about Bazaar.\n'),
139
     ('.bzr/branch-format', b'Bazaar-NG branch, format 0.0.4\n'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
140
     ('.bzr/revision-history',
6855.4.1 by Jelmer Vernooij
Yet more bees.
141
      b'mbp@sourcefrog.net-20051004035611-176b16534b086b3c\n'
142
      b'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd\n'),
143
     ('.bzr/merged-patches', b''),
144
     ('.bzr/pending-merged-patches', b''),
145
     ('.bzr/branch-name', b''),
146
     ('.bzr/branch-lock', b''),
147
     ('.bzr/pending-merges', b''),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
148
     ('.bzr/inventory',
6855.4.1 by Jelmer Vernooij
Yet more bees.
149
      b'<inventory>\n'
150
      b'<entry file_id="foo-20051004035605-91e788d1875603ae" kind="file" name="foo" />\n'
151
      b'</inventory>\n'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
152
     ('.bzr/stat-cache',
6855.4.1 by Jelmer Vernooij
Yet more bees.
153
      b'### bzr hashcache v5\n'
154
      b'foo// be9f309239729f69a6309e970ef24941d31e042c 13 1128398176 1128398176 303464 770\n'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
155
     ('.bzr/text-store/',),
156
     ('.bzr/text-store/foo-20051004035611-1591048e9dc7c2d4.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
157
      b'\x1f\x8b\x08\x00[\xfdAC\x02\xff\xcb\xcc\xcb,\xc9L\xccQH\xce\xcf+I\xcd+)\xe6\x02\x00\xdd\xcc\xf90\x11\x00\x00\x00'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
158
     ('.bzr/text-store/foo-20051004035756-4081373d897c3453.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
159
      b'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xff\xcbK-WH\xce\xcf+I\xcd+)\xe6\x02\x00g\xc3\xdf\xc9\r\x00\x00\x00'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
160
     ('.bzr/inventory-store/',),
161
     ('.bzr/inventory-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
162
      b'\x1f\x8b\x08\x00[\xfdAC\x02\xffm\x8f\xcd\n\xc20\x10\x84\xef>E\xc8\xbdt7?M\x02\xad\xaf"\xa1\x99`P[\xa8E\xacOo\x14\x05\x0f\xdef\xe1\xfbv\x98\xbeL7L\xeb\xbcl\xfb]_\xc3\xb2\x89\\\xce8\x944\xc8<\xcf\x8d"\xb2LdH\xdb\x8el\x13\x18\xce\xfb\xc4\xde\xd5SGHq*\xd3\x0b\xad\x8e\x14S\xbc\xe0\xadI\xb1\xe2\xbe\xfe}\xc2\xdc\xb0\rL\xc6#\xa4\xd1\x8d*\x99\x0f}=F\x1e$8G\x9d\xa0\x02\xa1rP9\x01c`FV\xda1qg\x98"\x02}\xa5\xf2\xa8\x95\xec\xa4h\xeb\x80\xf6g\xcd\x13\xb3\x01\xcc\x98\xda\x00\x00\x00'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
163
     ('.bzr/inventory-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
164
      b'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xffm\x8f\xc1\n\xc20\x10D\xef~E\xc8\xbd\xb8\x9bM\x9a,\xb4\xfe\x8a\xc4f\x83Am\xa1\x16\xb1~\xbdQ\x14<x\x9b\x81y3LW\xc6\x9b\x8c\xcb4\xaf\xbbMW\xc5\xbc\xaa\\\xce\xb2/\xa9\xd7y\x9a\x1a\x03\xe0\x10\xc0\x02\xb9\x16\\\xc3(>\x84\x84\xc1WKQ\xb4:\x95\xf1\x15\xad\x8cVc\xbc\xc8\x1b\xd3j\x91\xfb\xf2\xaf\xa4r\x8d\x85\x80\xe4)\x05\xf6\x03YG\x9f\xf4\xf5\x18\xb1\xd7\x07\xe1L\xc0\x86\xd8\x1b\xce-\xc7\xb6:a\x0f\x92\x8de\x8b\x89P\xc0\x9a\xe1\x0b\x95G\x9d\xc4\xda\xb1\xad\x07\xb6?o\x9e\xb5\xff\xf0\xf9\xda\x00\x00\x00'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
165
     ('.bzr/revision-store/',),
166
     ('.bzr/revision-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
167
      b'\x1f\x8b\x08\x00[\xfdAC\x02\xff\x9d\x8eKj\xc30\x14E\xe7^\x85\xd0 \xb3$\xefI\xd1\x8f\xd8\xa6\x1b(t\x07E?\xbb\x82H\n\xb2\x1ahW\xdfB1\x14:\xeb\xf4r\xee\xbdgl\xf1\x91\xb6T\x0b\xf15\xe7\xd4{l\x13}\xb6\xad\xa7B^j\xbd\x91\xc3\xad_\xb3\xbb?m\xf5\xbd\xf9\xb8\xb4\xba\x9eJ\xec\x87\xb5_)I\xe5\x11K\xaf\xed\xe35\x85\x89\xfe\xa5\x8e\x0c@ \xc0\x05\xb8\x90\x88GT\xd2\xa1\x14\xfc\xe2@K\xc7\xfd\xef\x85\xed\xcd\xe2D\x95\x8d\x1a\xa47<\x02c2\xb0 \xbc\xd0\x8ay\xa3\xbcp\x8a\x83\x12A3\xb7XJv\xef\x7f_\xf7\x94\xe3\xd6m\xbeO\x14\x91in4*<\x812\x88\xc60\xfc\x01>k\x89\x13\xe5\x12\x00\xe8<\x8c\xdf\x8d\xcd\xaeq\xb6!\x90\xa5\xd6\xf1\xbc\x07\xc3x\xde\x85\xe6\xe1\x0b\xc8\x8a\x98\x03T\x01\x00\x00'),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
168
     ('.bzr/revision-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
169
      b'\x1f\x8b\x08\x00\xc4\xfdAC\x02\xff\x9d\x90Kj\x031\x0c\x86\xf79\xc5\xe0Ev\xe9\xc8o\x9b\xcc\x84^\xa0\xd0\x1b\x14\xbf&5d\xec`\xbb\x81\xf6\xf45\x84\xa4\x81\xaeZ\xa1\x85\x84^\xdf\xaf\xa9\x84K\xac1\xa7\xc1\xe5u\x8d\xad\x852\xa3\x17SZL\xc3k\xce\xa7a{j\xfb\xd5\x9e\x9fk\xfe(.,%\x1f\x9fRh\xdbc\xdb\xa3!\xa6KH-\x97\xcf\xb7\xe8g\xf4\xbbkG\x008\x06`@\xb9\xe4bG(_\x88\x95\xde\xf9n\xca\xfb\xc7\r\xf5\xdd\xe0\x19\xa9\x85)\x81\xf5"\xbd\x04j\xb8\x02b\xa8W\\\x0b\xc9\x14\xf4\xbc\xbb\xd7\xd6H4\xdc\xb8\xff}\xba\xc55\xd4f\xd6\xf3\x8c0&\x8ajE\xa4x\xe2@\xa5\xa6\x9a\xf3k\xc3WNaFT\x00\x00:l\xa6>Q\xcd1\x1cjp9\xf9;\xc34\xde\n\x9b\xe9lJWT{t\',a\xf9\x0b\xae\xc0x\x87\xa5\xb0Xp\xca,(a\xa9{\xd0{}\xd4\x12\x04(\xc5\xbb$\xc5$V\xceaI\x19\x01\xa2\x1dh\xed\x82d\x8c.\xccr@\xc3\xd8Q\xc6\x1f\xaa\xf1\xb6\xe8\xb0\xf9\x06QR\r\xf9\xfc\x01\x00\x00')]
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
170
171
172
_ghost_template = [
173
    ( './foo',
6855.4.1 by Jelmer Vernooij
Yet more bees.
174
        b'hello\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
175
    ),
176
    ( './.bzr/', ),
177
    ( './.bzr/README',
6855.4.1 by Jelmer Vernooij
Yet more bees.
178
      b'This is a Bazaar control directory.\n'
179
      b'Do not change any files in this directory.\n'
180
      b'See http://bazaar.canonical.com/ for more information about Bazaar.\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
181
    ),
182
    ( './.bzr/branch-format',
6855.4.1 by Jelmer Vernooij
Yet more bees.
183
        b'Bazaar-NG branch, format 0.0.4\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
184
    ),
185
    ( './.bzr/branch-lock',
6855.4.1 by Jelmer Vernooij
Yet more bees.
186
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
187
    ),
188
    ( './.bzr/branch-name',
6855.4.1 by Jelmer Vernooij
Yet more bees.
189
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
190
    ),
191
    ( './.bzr/inventory',
6855.4.1 by Jelmer Vernooij
Yet more bees.
192
        b'<inventory>\n'
193
        b'<entry file_id="foo-20051004104918-0379cb7c76354cde" kind="file" name="foo" />\n'
194
        b'</inventory>\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
195
    ),
196
    ( './.bzr/merged-patches',
6855.4.1 by Jelmer Vernooij
Yet more bees.
197
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
198
    ),
199
    ( './.bzr/pending-merged-patches',
6855.4.1 by Jelmer Vernooij
Yet more bees.
200
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
201
    ),
202
    ( './.bzr/pending-merges',
6855.4.1 by Jelmer Vernooij
Yet more bees.
203
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
204
    ),
205
    ( './.bzr/revision-history',
6855.4.1 by Jelmer Vernooij
Yet more bees.
206
        b'mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b\n'
207
        b'mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
208
    ),
209
    ( './.bzr/stat-cache',
6855.4.1 by Jelmer Vernooij
Yet more bees.
210
        b'### bzr hashcache v5\n'
211
        b'foo// f572d396fae9206628714fb2ce00f72e94f2258f 6 1128422956 1128422956 306900 770\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
212
    ),
213
    ( './.bzr/text-store/', ),
214
    ( './.bzr/text-store/foo-20051004104921-8de8118a71be45ba.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
215
        b'\x1f\x8b\x08\x081^BC\x00\x03foo-20051004104921-8de8118a71be45ba\x00\xcbH\xcd\xc9\xc9\xe7\x02\x00 0:6\x06\x00\x00\x00'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
216
    ),
217
    ( './.bzr/inventory-store/', ),
218
    ( './.bzr/inventory-store/mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
219
        b'\x1f\x8b\x08\x081^BC\x00\x03mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b\x00m\x8f\xcb\n'
220
        b'\xc20\x10E\xf7~E\xc8\xbe83\xcd\x13\xaa\xbf"yL0\xa8-\xd4"\xd6\xaf7\x8a\x82\x0bw\xb38\xe7\xde;C\x1do<.\xd3\xbc\xee7C;\xe6U\x94z\xe6C\xcd;Y\xa6\xa9#\x00\x8d\x00\n'
221
        b'Ayt\x1d\xf4\xd6\xa7h\x935\xbdV)\xb3\x14\xa7:\xbe\xd0\xe6H1\x86\x0b\xbf5)\x16\xbe/\x7fC\x08;\x97\xd9!\xba`1\xb2\xd21|\xe8\xeb1`\xe3\xb5\xa5\xdc{S\x02{\x02c\xc8YT%Rb\x80b\x89\xbd*D\xda\x95\xafT\x1f\xad\xd2H\xb1m\xfb\xb7?\xcf<\x01W}\xb5\x8b\xd9\x00\x00\x00'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
222
    ),
223
    ( './.bzr/inventory-store/mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
224
        b'\x1f\x8b\x08\x08A^BC\x00\x03mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d\x00m\x8f\xcb\n'
225
        b'\xc20\x10E\xf7~E\xc8\xbe83\xcd\x13\xaa\xbf"yL0\xa8-\xd4"\xd6\xaf7\x8a\x82\x0bw\xb38\xe7\xde;C\x1do<.\xd3\xbc\xee7C;\xe6U\x94z\xe6C\xcd;Y\xa6\xa9#\x00\x8d\x00\n'
226
        b'Ayt\x1d\xf4\xd6\xa7h\x935\xbdV)\xb3\x14\xa7:\xbe\xd0\xe6H1\x86\x0b\xbf5)\x16\xbe/\x7fC\x08;\x97\xd9!\xba`1\xb2\xd21|\xe8\xeb1`\xe3\xb5\xa5\xdc{S\x02{\x02c\xc8YT%Rb\x80b\x89\xbd*D\xda\x95\xafT\x1f\xad\xd2H\xb1m\xfb\xb7?\xcf<\x01W}\xb5\x8b\xd9\x00\x00\x00'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
227
    ),
228
    ( './.bzr/revision-store/', ),
229
    ( './.bzr/revision-store/mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
230
        b'\x1f\x8b\x08\x081^BC\x00\x03mbp@sourcefrog.net-20051004104921-a98be2278dd30b7b\x00\x9d\x8eMj\xc30\x14\x84\xf7>\x85\xd0"\xbb$\xef\xc9\xb6,\x11\xdb\xf4\x02\x85\xde\xa0\xe8\xe7\xd9\x11\xc4R\x90\xd4@{\xfa\x06\x8a\xa1\xd0]\x97\x03\xdf\xcc|c\xa6G(!E\xe6\xd2\xb6\x85Z)O\xfc\xd5\xe4\x1a"{K\xe9\xc6\x0e\xb7z\xd9\xec\xfd\xa5\xa4\x8f\xech\xc9i=E\xaa\x87\xb5^8\x0b\xf1A\xb1\xa6\xfc\xf9\x1e\xfc\xc4\xffRG\x01\xd0#@\x87\xd0i\x81G\xa3\x95%!\x06\xe5}\x0bv\xb0\xbf\x17\xca\xd5\xe0\xc4-\xa0\xb1\x8b\xb6`\xc0I\xa4\xc5\xf4\x9el\xef\x95v [\x94\xcf\x8e\xd5\xcay\xe4l\xf7\xfe\xf7u\r'
231
        b'\x1b\x95j\xb6\xfb\xc4\x11\x85\xea\x84\xd0\x12O\x03t\x83D\xad\xc4\x0f\xf0\x95"M\xbc\x95\x00\xc0\xe7f|6\x8aYi^B.u<\xef\xb1\x19\xcf\xbb\xce\xdc|\x038=\xc7\xe6R\x01\x00\x00'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
232
    ),
233
    ( './.bzr/revision-store/mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
234
        b'\x1f\x8b\x08\x08A^BC\x00\x03mbp@sourcefrog.net-20051004104937-c9b7a7bfcc0bb22d\x00\x9d\x90\xc1j\xc30\x0c\x86\xef}\n'
235
        b"\xe3Coie'\xb1c\x9a\x94\xbe\xc0`o0,[N\x03M\\\x1c\xafe{\xfae\x94n\x85\xc1`;Y\x88O\xd2\xff\xb9Mt\x19\xe6!N\xcc\xc5q\x1cr\xa6\xd4\xf1'\x9b\xf20\xb1\xe7\x18Ol}\xca\xbb\x11\xcf\x879\xbe&G!\xc5~3Q^\xf7y\xc7\xd90]h\xca1\xbd\xbd\x0c\xbe\xe3?\xa9B\x02\xd4\x02\xa0\x12P\x99R\x17\xce\xa0\xb6\x1a\x83s\x80(\xa5\x7f\xdc0\x1f\xad\xe88\x82\xb0\x18\x0c\x82\x05\xa7\x04\x05[{\xc2\xda7\xc6\x81*\x85B\x8dh\x1a\xe7\x05g\xf7\xdc\xff>\x9d\x87\x91\xe6l\xc7s\xc7\x85\x90M%\xa5\xd1z#\x85\xa8\x9b\x1a\xaa\xfa\x06\xbc\xc7\x89:^*\x00\xe0\xfbU\xbbL\xcc\xb6\xa7\xfdH\xa9'\x16\x03\xeb\x8fq\xce\xed\xf6\xde_\xb5g\x9b\x16\xa1y\xa9\xbe\x02&\n"
236
        b'\x7fJ+EaM\x83$\xa5n\xbc/a\x91~\xd0\xbd\xfd\x135\n'
237
        b'\xd0\x9a`\x0c*W\x1aR\xc1\x94du\x08(\t\xb0\x91\xdeZ\xa3\x9cU\x9cm\x7f\x8dr\x1d\x10Ot\xb8\xc6\xcf\xa7\x907|\xfb-\xb1\xbd\xd3\xfb\xd5\x07\xeeD\xee\x08*\x02\x00\x00'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
238
    ),
239
]
240
241
_upgrade_dir_template = [
242
    ( './.bzr/', ),
243
    ( './.bzr/README',
6855.4.1 by Jelmer Vernooij
Yet more bees.
244
      b'This is a Bazaar control directory.\n'
245
      b'Do not change any files in this directory.\n'
246
      b'See http://bazaar.canonical.com/ for more information about Bazaar.\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
247
    ),
248
    ( './.bzr/branch-format',
6855.4.1 by Jelmer Vernooij
Yet more bees.
249
        b'Bazaar-NG branch, format 0.0.4\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
250
    ),
251
    ( './.bzr/branch-lock',
6855.4.1 by Jelmer Vernooij
Yet more bees.
252
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
253
    ),
254
    ( './.bzr/branch-name',
6855.4.1 by Jelmer Vernooij
Yet more bees.
255
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
256
    ),
257
    ( './.bzr/inventory',
6855.4.1 by Jelmer Vernooij
Yet more bees.
258
        b'<inventory>\n'
259
        b'<entry file_id="dir-20051005095101-da1441ea3fa6917a" kind="directory" name="dir" />\n'
260
        b'</inventory>\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
261
    ),
262
    ( './.bzr/merged-patches',
6855.4.1 by Jelmer Vernooij
Yet more bees.
263
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
264
    ),
265
    ( './.bzr/pending-merged-patches',
6855.4.1 by Jelmer Vernooij
Yet more bees.
266
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
267
    ),
268
    ( './.bzr/pending-merges',
6855.4.1 by Jelmer Vernooij
Yet more bees.
269
        b''
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
270
    ),
271
    ( './.bzr/revision-history',
6855.4.1 by Jelmer Vernooij
Yet more bees.
272
        b'robertc@robertcollins.net-20051005095108-6065fbd8e7d8617e\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
273
    ),
274
    ( './.bzr/stat-cache',
6855.4.1 by Jelmer Vernooij
Yet more bees.
275
        b'### bzr hashcache v5\n'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
276
    ),
277
    ( './.bzr/text-store/', ),
278
    ( './.bzr/inventory-store/', ),
279
    ( './.bzr/inventory-store/robertc@robertcollins.net-20051005095108-6065fbd8e7d8617e.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
280
        b'\x1f\x8b\x08\x00\x0c\xa2CC\x02\xff\xb3\xc9\xcc+K\xcd+\xc9/\xaa\xb4\xe3\xb2\x012\x8a*\x15\xd22sR\xe33Sl\x95R2\x8bt\x8d\x0c\x0cL\r'
281
        b"\x81\xd8\xc0\x12H\x19\xea\xa6$\x1a\x9a\x98\x18\xa6&\x1a\xa7%\x9aY\x1a\x9a'*)dg\xe6A\x94\xa6&\x83LQR\xc8K\xccM\x05\x0b()\xe8\x03\xcd\xd4G\xb2\x00\x00\xc2<\x94\xb1m\x00\x00\x00"
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
282
    ),
283
    ( './.bzr/revision-store/', ),
284
    ( './.bzr/revision-store/robertc@robertcollins.net-20051005095108-6065fbd8e7d8617e.gz',
6855.4.1 by Jelmer Vernooij
Yet more bees.
285
        b'\x1f\x8b\x08\x00\x0c\xa2CC\x02\xff\xa5OKj\xc30\x14\xdc\xfb\x14B\x8b\xec\x92<I\xd6\xc7\xc42\x85\xde\xa0\x17(\xb6\xf4\x9c\n'
286
        b'l\xa9H"\x90\x9c\xbe\xa6\xa9\xa1\x9b\xae\xbax\x0c\xcc\xe71\xd3g\xbc\x85\x12R$.\xadk\xa8\x15\xb3\xa5oi\xc2\\\xc9kZ\x96\x10\x0b9,\xf5\x92\xbf)\xf7\xf2\x83O\xe5\x14\xb1\x1e\xae\xf5BI\x887\x8c5\xe5\xfb{\xf0\x96\xfei>r\x00\xc9\xb6\x83n\x03sT\xa0\xe4<y\x83\xda\x1b\xc54\xfe~T>Ff\xe9\xcc:\xdd\x8e\xa6E\xc7@\xa2\x82I\xaaNL\xbas\\313)\x00\xb9\xe6\xe0(\xd9\x87\xfc\xb7A\r'
287
        b"+\x96:\xae\x9f\x962\xc6\x8d\x04i\x949\x01\x97R\xb7\x1d\x17O\xc3#E\xb4T(\x00\xa0C\xd3o\x892^q\x18\xbd'>\xe4\xfe\xbc\x13M\x7f\xde{\r"
288
        b'\xcd\x17\x85\xea\xba\x03l\x01\x00\x00'
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
289
    ),
290
    ( './dir/', ),
291
]
292
293
294
class TestUpgrade(TestCaseWithTransport):
295
296
    def test_upgrade_v6_to_meta_no_workingtree(self):
297
        # Some format6 branches do not have checkout files. Upgrading
298
        # such a branch to metadir must not setup a working tree.
299
        self.build_tree_contents(_upgrade1_template)
300
        upgrade.upgrade('.', BzrDirFormat6())
301
        t = self.get_transport('.')
6926.1.1 by Jelmer Vernooij
Remove delete_multi.
302
        t.delete('.bzr/pending-merges')
303
        t.delete('.bzr/inventory')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
304
        self.assertFalse(t.has('.bzr/stat-cache'))
305
        t.delete_tree('backup.bzr.~1~')
306
        # At this point, we have a format6 branch without checkout files.
307
        upgrade.upgrade('.', bzrdir.BzrDirMetaFormat1())
308
        # The upgrade should not have set up a working tree.
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
309
        control = controldir.ControlDir.open('.')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
310
        self.assertFalse(control.has_workingtree())
311
        # We have covered the scope of this test, we may as well check that
312
        # upgrade has not eaten our data, even if it's a bit redundant with
313
        # other tests.
5784.1.4 by Martin Pool
Update weave format tests to avoid failIf, failUnless, etc
314
        self.assertIsInstance(control._format, bzrdir.BzrDirMetaFormat1)
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
315
        b = control.open_branch()
6165.4.26 by Jelmer Vernooij
Fix locking.
316
        self.addCleanup(b.lock_read().unlock)
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
317
        self.assertEqual(b._revision_history(),
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
318
           ['mbp@sourcefrog.net-20051004035611-176b16534b086b3c',
319
            'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd'])
320
321
    def test_upgrade_simple(self):
322
        """Upgrade simple v0.0.4 format to latest format"""
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
323
        eq = self.assertEqual
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
324
        self.build_tree_contents(_upgrade1_template)
325
        upgrade.upgrade(u'.')
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
326
        control = controldir.ControlDir.open('.')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
327
        b = control.open_branch()
328
        # tsk, peeking under the covers.
5784.1.4 by Martin Pool
Update weave format tests to avoid failIf, failUnless, etc
329
        self.assertIsInstance(
330
            control._format,
331
            bzrdir.BzrDirFormat.get_default_format().__class__)
6165.4.26 by Jelmer Vernooij
Fix locking.
332
        self.addCleanup(b.lock_read().unlock)
6165.4.25 by Jelmer Vernooij
Fix plugin use of revision_history.
333
        rh = b._revision_history()
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
334
        eq(rh,
335
           ['mbp@sourcefrog.net-20051004035611-176b16534b086b3c',
336
            'mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd'])
337
        rt = b.repository.revision_tree(rh[0])
338
        foo_id = 'foo-20051004035605-91e788d1875603ae'
339
        rt.lock_read()
340
        try:
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
341
            eq(rt.get_file_text('foo', foo_id), 'initial contents\n')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
342
        finally:
343
            rt.unlock()
344
        rt = b.repository.revision_tree(rh[1])
345
        rt.lock_read()
346
        try:
6809.4.5 by Jelmer Vernooij
Swap arguments for get_file_*.
347
            eq(rt.get_file_text('foo', foo_id), 'new contents\n')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
348
        finally:
349
            rt.unlock()
350
        # check a backup was made:
351
        backup_dir = 'backup.bzr.~1~'
352
        t = self.get_transport('.')
353
        t.stat(backup_dir)
354
        t.stat(backup_dir + '/README')
355
        t.stat(backup_dir + '/branch-format')
356
        t.stat(backup_dir + '/revision-history')
357
        t.stat(backup_dir + '/merged-patches')
358
        t.stat(backup_dir + '/pending-merged-patches')
359
        t.stat(backup_dir + '/pending-merges')
360
        t.stat(backup_dir + '/branch-name')
361
        t.stat(backup_dir + '/branch-lock')
362
        t.stat(backup_dir + '/inventory')
363
        t.stat(backup_dir + '/stat-cache')
364
        t.stat(backup_dir + '/text-store')
365
        t.stat(backup_dir + '/text-store/foo-20051004035611-1591048e9dc7c2d4.gz')
366
        t.stat(backup_dir + '/text-store/foo-20051004035756-4081373d897c3453.gz')
367
        t.stat(backup_dir + '/inventory-store/')
368
        t.stat(backup_dir + '/inventory-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz')
369
        t.stat(backup_dir + '/inventory-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz')
370
        t.stat(backup_dir + '/revision-store/')
371
        t.stat(backup_dir + '/revision-store/mbp@sourcefrog.net-20051004035611-176b16534b086b3c.gz')
372
        t.stat(backup_dir + '/revision-store/mbp@sourcefrog.net-20051004035756-235f2b7dcdddd8dd.gz')
373
374
    def test_upgrade_with_ghosts(self):
375
        """Upgrade v0.0.4 tree containing ghost references.
376
377
        That is, some of the parents of revisions mentioned in the branch
378
        aren't present in the branch's storage.
379
380
        This shouldn't normally happen in branches created entirely in
381
        bzr, but can happen in branches imported from baz and arch, or from
382
        other systems, where the importer knows about a revision but not
383
        its contents."""
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
384
        eq = self.assertEqual
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
385
        self.build_tree_contents(_ghost_template)
386
        upgrade.upgrade(u'.')
387
        b = branch.Branch.open(u'.')
6165.4.26 by Jelmer Vernooij
Fix locking.
388
        self.addCleanup(b.lock_read().unlock)
6165.4.25 by Jelmer Vernooij
Fix plugin use of revision_history.
389
        revision_id = b._revision_history()[1]
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
390
        rev = b.repository.get_revision(revision_id)
391
        eq(len(rev.parent_ids), 2)
392
        eq(rev.parent_ids[1], 'wibble@wobble-2')
393
394
    def test_upgrade_makes_dir_weaves(self):
395
        self.build_tree_contents(_upgrade_dir_template)
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
396
        old_repodir = controldir.ControlDir.open_unsupported('.')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
397
        old_repo_format = old_repodir.open_repository()._format
398
        upgrade.upgrade('.')
399
        # this is the path to the literal file. As format changes
400
        # occur it needs to be updated. FIXME: ask the store for the
401
        # path.
402
        repo = repository.Repository.open('.')
403
        # it should have changed the format
404
        self.assertNotEqual(old_repo_format.__class__, repo._format.__class__)
405
        # and we should be able to read the names for the file id
406
        # 'dir-20051005095101-da1441ea3fa6917a'
407
        repo.lock_read()
408
        self.addCleanup(repo.unlock)
409
        text_keys = repo.texts.keys()
410
        dir_keys = [key for key in text_keys if key[0] ==
411
                'dir-20051005095101-da1441ea3fa6917a']
412
        self.assertNotEqual([], dir_keys)
413
414
    def test_upgrade_to_meta_sets_workingtree_last_revision(self):
415
        self.build_tree_contents(_upgrade_dir_template)
416
        upgrade.upgrade('.', bzrdir.BzrDirMetaFormat1())
417
        tree = workingtree.WorkingTree.open('.')
6165.4.26 by Jelmer Vernooij
Fix locking.
418
        self.addCleanup(tree.lock_read().unlock)
6165.4.25 by Jelmer Vernooij
Fix plugin use of revision_history.
419
        self.assertEqual([tree.branch._revision_history()[-1]],
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
420
            tree.get_parent_ids())
421
422
423
class SFTPBranchTest(TestCaseWithSFTPServer):
424
    """Test some stuff when accessing a bzr Branch over sftp"""
425
426
    def test_lock_file(self):
427
        # old format branches use a special lock file on sftp.
428
        b = self.make_branch('', format=BzrDirFormat6())
429
        b = branch.Branch.open(self.get_url())
5784.1.4 by Martin Pool
Update weave format tests to avoid failIf, failUnless, etc
430
        self.assertPathExists('.bzr/')
431
        self.assertPathExists('.bzr/branch-format')
432
        self.assertPathExists('.bzr/branch-lock')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
433
5784.1.4 by Martin Pool
Update weave format tests to avoid failIf, failUnless, etc
434
        self.assertPathDoesNotExist('.bzr/branch-lock.write-lock')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
435
        b.lock_write()
5784.1.4 by Martin Pool
Update weave format tests to avoid failIf, failUnless, etc
436
        self.assertPathExists('.bzr/branch-lock.write-lock')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
437
        b.unlock()
5784.1.4 by Martin Pool
Update weave format tests to avoid failIf, failUnless, etc
438
        self.assertPathDoesNotExist('.bzr/branch-lock.write-lock')
5712.4.1 by Jelmer Vernooij
Move weave-era BzrDir directories to a separate file.
439
440
441
class TestInfo(TestCaseWithTransport):
442
443
    def test_info_locking_oslocks(self):
444
        if sys.platform == "win32":
445
            self.skip("don't use oslocks on win32 in unix manner")
446
        # This test tests old (all-in-one, OS lock using) behaviour which
447
        # simply cannot work on windows (and is indeed why we changed our
448
        # design. As such, don't try to remove the thisFailsStrictLockCheck
449
        # call here.
450
        self.thisFailsStrictLockCheck()
451
452
        tree = self.make_branch_and_tree('branch',
453
                                         format=BzrDirFormat6())
454
455
        # Test all permutations of locking the working tree, branch and repository
456
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
457
        # implemented by raising NotImplementedError and get_physical_lock_status()
458
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
459
        # W B R
460
461
        # U U U
462
        out, err = self.run_bzr('info -v branch')
463
        self.assertEqualDiff(
464
"""Standalone tree (format: weave)
465
Location:
466
  branch root: %s
467
468
Format:
469
       control: All-in-one format 6
470
  working tree: Working tree format 2
471
        branch: Branch format 4
472
    repository: %s
473
474
In the working tree:
475
         0 unchanged
476
         0 modified
477
         0 added
478
         0 removed
479
         0 renamed
480
         0 unknown
481
         0 ignored
482
         0 versioned subdirectories
483
484
Branch history:
485
         0 revisions
486
487
Repository:
488
         0 revisions
489
""" % ('branch', tree.branch.repository._format.get_format_description(),
490
       ), out)
491
        self.assertEqual('', err)
492
        # L L L
493
        tree.lock_write()
494
        out, err = self.run_bzr('info -v branch')
495
        self.assertEqualDiff(
496
"""Standalone tree (format: weave)
497
Location:
498
  branch root: %s
499
500
Format:
501
       control: All-in-one format 6
502
  working tree: Working tree format 2
503
        branch: Branch format 4
504
    repository: %s
505
506
In the working tree:
507
         0 unchanged
508
         0 modified
509
         0 added
510
         0 removed
511
         0 renamed
512
         0 unknown
513
         0 ignored
514
         0 versioned subdirectories
515
516
Branch history:
517
         0 revisions
518
519
Repository:
520
         0 revisions
521
""" % ('branch', tree.branch.repository._format.get_format_description(),
522
       ), out)
523
        self.assertEqual('', err)
524
        tree.unlock()
525
526
5582.10.91 by Jelmer Vernooij
Fix some tests.
527
class TestBranchFormat4(TestCaseWithTransport):
528
    """Tests specific to branch format 4"""
529
530
    def test_no_metadir_support(self):
531
        url = self.get_url()
532
        bdir = bzrdir.BzrDirMetaFormat1().initialize(url)
533
        bdir.create_repository()
534
        self.assertRaises(errors.IncompatibleFormat,
535
            BzrBranchFormat4().initialize, bdir)
536
537
    def test_supports_bzrdir_6(self):
538
        url = self.get_url()
5582.10.97 by Jelmer Vernooij
Fix import of BzrDirFormat6 after merge.
539
        bdir = BzrDirFormat6().initialize(url)
5582.10.91 by Jelmer Vernooij
Fix some tests.
540
        bdir.create_repository()
541
        BzrBranchFormat4().initialize(bdir)
542
543
544
class TestBoundBranch(TestCaseWithTransport):
545
546
    def setUp(self):
547
        super(TestBoundBranch, self).setUp()
548
        self.build_tree(['master/', 'child/'])
549
        self.make_branch_and_tree('master')
550
        self.make_branch_and_tree('child',
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
551
                        format=controldir.format_registry.make_controldir('weave'))
5582.10.91 by Jelmer Vernooij
Fix some tests.
552
        os.chdir('child')
553
554
    def test_bind_format_6_bzrdir(self):
555
        # bind on a format 6 bzrdir should error
6809.1.1 by Martin
Apply 2to3 ws_comma fixer
556
        out, err = self.run_bzr('bind ../master', retcode=3)
5582.10.91 by Jelmer Vernooij
Fix some tests.
557
        self.assertEqual('', out)
558
        # TODO: jam 20060427 Probably something like this really should
559
        #       print out the actual path, rather than the URL
560
        cwd = urlutils.local_path_to_url(getcwd())
6622.1.31 by Jelmer Vernooij
Fix more tests.
561
        self.assertEqual('brz: ERROR: To use this feature you must '
5582.10.91 by Jelmer Vernooij
Fix some tests.
562
                         'upgrade your branch at %s/.\n' % cwd, err)
563
564
    def test_unbind_format_6_bzrdir(self):
565
        # bind on a format 6 bzrdir should error
6809.1.1 by Martin
Apply 2to3 ws_comma fixer
566
        out, err = self.run_bzr('unbind', retcode=3)
5582.10.91 by Jelmer Vernooij
Fix some tests.
567
        self.assertEqual('', out)
568
        cwd = urlutils.local_path_to_url(getcwd())
6622.1.31 by Jelmer Vernooij
Fix more tests.
569
        self.assertEqual('brz: ERROR: To use this feature you must '
5582.10.91 by Jelmer Vernooij
Fix some tests.
570
                         'upgrade your branch at %s/.\n' % cwd, err)
571
572
573
class TestInit(TestCaseWithTransport):
574
575
    def test_init_weave(self):
576
        # --format=weave should be accepted to allow interoperation with
577
        # old releases when desired.
578
        out, err = self.run_bzr('init --format=weave')
579
        self.assertEqual("""Created a standalone tree (format: weave)\n""",
580
            out)
581
        self.assertEqual('', err)
5582.10.92 by Jelmer Vernooij
Move more weave code.
582
583
6710.1.1 by Jelmer Vernooij
Don't import V4BundleTester directly, but via a module import.
584
class V4WeaveBundleTester(test_bundle.V4BundleTester):
5582.10.92 by Jelmer Vernooij
Move more weave code.
585
586
    def bzrdir_format(self):
587
        return 'metaweave'