/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) 2006-2012, 2016 Canonical Ltd
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
2
#
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
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.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
7
#
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
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.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
12
#
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
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
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
16
17
18
"""Tests for the info command of bzr."""
19
6241.4.3 by Jelmer Vernooij
Add test for dangling tree references.
20
import shutil
1769.2.1 by Alexander Belchenko
win32 fix for blackbox.test_info.TestInfo.test_info_non_existing
21
import sys
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
22
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
23
from breezy import (
3575.1.1 by Andrew Bennetts
Tidy imports in blackbox.test_info, fixing trivial test failure caused by a missing import.
24
    branch,
6207.3.3 by jelmer at samba
Fix tests and the like.
25
    controldir,
2804.4.1 by Alexander Belchenko
some win32-specific fixes for selftest
26
    errors,
3010.1.13 by Robert Collins
Use the info code functions to determine format strings in the blackbox tests, and handle repositories that do not lock like packs.
27
    info,
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
28
    osutils,
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
29
    tests,
3575.1.1 by Andrew Bennetts
Tidy imports in blackbox.test_info, fixing trivial test failure caused by a missing import.
30
    upgrade,
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
31
    urlutils,
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
32
    )
6670.4.3 by Jelmer Vernooij
Fix more imports.
33
from breezy.bzr import (
34
    bzrdir,
35
    )
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
36
from breezy.transport import memory
5017.3.38 by Vincent Ladeuil
-s bb.test_info passing
37
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
38
39
class TestInfo(tests.TestCaseWithTransport):
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
40
4599.3.1 by Robert Collins
Factor out some string duplication from blackbox.test_info to make changing the default format easier.
41
    def setUp(self):
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
42
        super(TestInfo, self).setUp()
4976.2.1 by Ian Clatworthy
Hide most storage formats
43
        self._repo_strings = "2a"
4599.3.1 by Robert Collins
Factor out some string duplication from blackbox.test_info to make changing the default format easier.
44
1694.2.6 by Martin Pool
[merge] bzr.dev
45
    def test_info_non_existing(self):
5017.3.45 by Vincent Ladeuil
Move MemoryServer back into bzrlib.transport.memory as it's needed as soon as a MemoryTransport is used. Add a NEWS entry.
46
        self.vfs_transport_factory = memory.MemoryServer
4691.2.1 by Robert Collins
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite.
47
        location = self.get_url()
7143.15.2 by Jelmer Vernooij
Run autopep8.
48
        out, err = self.run_bzr('info ' + location, retcode=3)
1694.2.6 by Martin Pool
[merge] bzr.dev
49
        self.assertEqual(out, '')
6622.1.29 by Jelmer Vernooij
Fix some more tests.
50
        self.assertEqual(err, 'brz: ERROR: Not a branch: "%s".\n' % location)
1694.2.6 by Martin Pool
[merge] bzr.dev
51
6241.4.2 by Jelmer Vernooij
No longer show empty output when only control directory is present.
52
    def test_info_empty_controldir(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
53
        self.make_controldir('ctrl')
6241.4.2 by Jelmer Vernooij
No longer show empty output when only control directory is present.
54
        out, err = self.run_bzr('info ctrl')
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
55
        self.assertEqual(out,
7143.15.2 by Jelmer Vernooij
Run autopep8.
56
                         'Empty control directory (format: 2a)\n'
57
                         'Location:\n'
58
                         '  control directory: ctrl\n')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
59
        self.assertEqual(err, '')
6241.4.2 by Jelmer Vernooij
No longer show empty output when only control directory is present.
60
6437.33.4 by Jelmer Vernooij
Add test.
61
    def test_info_empty_controldir_verbose(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
62
        self.make_controldir('ctrl')
6437.33.4 by Jelmer Vernooij
Add test.
63
        out, err = self.run_bzr('info -v ctrl')
6437.33.5 by Jelmer Vernooij
Fix test.
64
        self.assertEqualDiff(out,
7143.15.2 by Jelmer Vernooij
Run autopep8.
65
                             'Empty control directory (format: 2a)\n'
66
                             'Location:\n'
67
                             '  control directory: ctrl\n\n'
68
                             'Format:\n'
69
                             '       control: Meta directory format 1\n\n'
70
                             'Control directory:\n'
71
                             '         0 branches\n')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
72
        self.assertEqual(err, '')
6437.33.4 by Jelmer Vernooij
Add test.
73
6241.4.3 by Jelmer Vernooij
Add test for dangling tree references.
74
    def test_info_dangling_branch_reference(self):
75
        br = self.make_branch('target')
76
        br.create_checkout('from', lightweight=True)
77
        shutil.rmtree('target')
78
        out, err = self.run_bzr('info from')
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
79
        self.assertEqual(out,
7143.15.2 by Jelmer Vernooij
Run autopep8.
80
                         'Dangling branch reference (format: 2a)\n'
81
                         'Location:\n'
82
                         '   control directory: from\n'
83
                         '  checkout of branch: target\n')
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
84
        self.assertEqual(err, '')
6241.4.3 by Jelmer Vernooij
Add test for dangling tree references.
85
7211.9.1 by Jelmer Vernooij
Report colocated branch name in 'brz info'.
86
    def test_info_colocated(self):
87
        br = self.make_branch_and_tree('target', format='development-colo')
88
        target = br.controldir.create_branch(name='dichtbij')
89
        br.controldir.set_branch_reference(target)
90
        out, err = self.run_bzr('info target')
91
        self.assertEqual(out,
92
                         'Standalone tree (format: development-colo)\n'
93
                         'Location:\n'
94
                         '            light checkout root: target\n'
95
                         '  checkout of co-located branch: dichtbij\n')
96
        self.assertEqual(err, '')
97
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
98
    def test_info_standalone(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
99
        transport = self.get_transport()
100
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
101
        # Create initial standalone branch
5582.10.91 by Jelmer Vernooij
Fix some tests.
102
        tree1 = self.make_branch_and_tree('standalone', 'knit')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
103
        self.build_tree(['standalone/a'])
104
        tree1.add('a')
105
        branch1 = tree1.branch
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
106
107
        out, err = self.run_bzr('info standalone')
108
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
109
            """Standalone tree (format: knit)
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
110
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
111
  branch root: standalone
112
""", out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
113
        self.assertEqual('', err)
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
114
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
115
        # Standalone branch - verbose mode
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
116
        out, err = self.run_bzr('info standalone -v')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
117
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
118
            """Standalone tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
119
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
120
  branch root: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
121
122
Format:
5582.10.91 by Jelmer Vernooij
Fix some tests.
123
       control: Meta directory format 1
124
  working tree: Working tree format 3
125
        branch: Branch format 5
126
    repository: Knit repository format 1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
127
6437.21.4 by Jelmer Vernooij
Fix info tests.
128
Control directory:
129
         1 branches
130
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
131
In the working tree:
132
         0 unchanged
133
         0 modified
134
         1 added
135
         0 removed
136
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
137
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
138
         0 unknown
139
         0 ignored
140
         0 versioned subdirectories
141
142
Branch history:
143
         0 revisions
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
144
145
Repository:
146
         0 revisions
147
""", out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
148
        self.assertEqual('', err)
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
149
150
        # Standalone branch - really verbose mode
151
        out, err = self.run_bzr('info standalone -vv')
152
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
153
            """Standalone tree (format: knit)
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
154
Location:
155
  branch root: standalone
156
157
Format:
5582.10.91 by Jelmer Vernooij
Fix some tests.
158
       control: Meta directory format 1
159
  working tree: Working tree format 3
160
        branch: Branch format 5
161
    repository: Knit repository format 1
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
162
6437.21.4 by Jelmer Vernooij
Fix info tests.
163
Control directory:
164
         1 branches
165
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
166
In the working tree:
167
         0 unchanged
168
         0 modified
169
         1 added
170
         0 removed
171
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
172
         0 copied
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
173
         0 unknown
174
         0 ignored
175
         0 versioned subdirectories
176
177
Branch history:
178
         0 revisions
2363.5.11 by Aaron Bentley
All info tests pass
179
         0 committers
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
180
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
181
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
182
         0 revisions
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
183
""", out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
184
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
185
        tree1.commit('commit one')
6165.4.1 by Jelmer Vernooij
Avoid using revision_history.
186
        rev = branch1.repository.get_revision(branch1.last_revision())
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
187
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
188
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
189
        # Branch standalone with push location
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
190
        branch2 = branch1.controldir.sprout('branch').open_branch()
191
        branch2.set_push_location(branch1.controldir.root_transport.base)
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
192
193
        out, err = self.run_bzr('info branch')
194
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
195
            """Standalone tree (format: knit)
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
196
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
197
  branch root: branch
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
198
199
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
200
    push branch: standalone
201
  parent branch: standalone
202
""", out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
203
        self.assertEqual('', err)
2584.2.1 by Adeodato Simó
Make `bzr info` show related branches in non-verbose mode.
204
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
205
        out, err = self.run_bzr('info branch --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
206
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
207
            """Standalone tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
208
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
209
  branch root: branch
1694.2.6 by Martin Pool
[merge] bzr.dev
210
211
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
212
    push branch: standalone
213
  parent branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
214
215
Format:
5582.10.91 by Jelmer Vernooij
Fix some tests.
216
       control: Meta directory format 1
217
  working tree: Working tree format 3
218
        branch: Branch format 5
219
    repository: Knit repository format 1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
220
6437.21.4 by Jelmer Vernooij
Fix info tests.
221
Control directory:
222
         1 branches
223
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
224
In the working tree:
225
         1 unchanged
226
         0 modified
227
         0 added
228
         0 removed
229
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
230
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
231
         0 unknown
232
         0 ignored
233
         0 versioned subdirectories
234
235
Branch history:
236
         1 revision
237
         0 days old
238
   first revision: %s
239
  latest revision: %s
240
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
241
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
242
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
243
""" % (datestring_first, datestring_first,
1694.2.6 by Martin Pool
[merge] bzr.dev
244
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
245
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
246
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
247
        # Branch and bind to standalone, needs upgrade to metadir
248
        # (creates backup as unknown)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
249
        branch1.controldir.sprout('bound')
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
250
        knit1_format = controldir.format_registry.make_controldir('knit')
3575.1.1 by Andrew Bennetts
Tidy imports in blackbox.test_info, fixing trivial test failure caused by a missing import.
251
        upgrade.upgrade('bound', knit1_format)
6207.3.3 by jelmer at samba
Fix tests and the like.
252
        branch3 = controldir.ControlDir.open('bound').open_branch()
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
253
        branch3.bind(branch1)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
254
        bound_tree = branch3.controldir.open_workingtree()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
255
        out, err = self.run_bzr('info -v bound')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
256
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
257
            """Checkout (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
258
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
259
       checkout root: bound
260
  checkout of branch: standalone
1694.2.6 by Martin Pool
[merge] bzr.dev
261
262
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
263
  parent branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
264
265
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
266
       control: Meta directory format 1
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
267
  working tree: %s
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
268
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
269
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
270
6437.21.4 by Jelmer Vernooij
Fix info tests.
271
Control directory:
272
         1 branches
273
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
274
In the working tree:
275
         1 unchanged
276
         0 modified
277
         0 added
278
         0 removed
279
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
280
         0 copied
5035.4.8 by Martin Pool
Update info tests to cope with backup.bzr being ignored
281
         0 unknown
5582.10.91 by Jelmer Vernooij
Fix some tests.
282
         0 ignored
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
283
         0 versioned subdirectories
284
285
Branch history:
286
         1 revision
287
         0 days old
288
   first revision: %s
289
  latest revision: %s
290
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
291
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
292
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
293
""" % (bound_tree._format.get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
294
                branch3._format.get_format_description(),
295
                branch3.repository._format.get_format_description(),
296
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
297
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
298
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
299
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
300
        # Checkout standalone (same as above, but does not have parent set)
6207.3.3 by jelmer at samba
Fix tests and the like.
301
        branch4 = controldir.ControlDir.create_branch_convenience('checkout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
302
                                                                  format=knit1_format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
303
        branch4.bind(branch1)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
304
        branch4.controldir.open_workingtree().update()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
305
        out, err = self.run_bzr('info checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
306
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
307
            """Checkout (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
308
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
309
       checkout root: checkout
310
  checkout of branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
311
312
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
313
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
314
  working tree: Working tree format 3
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
315
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
316
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
317
6437.21.4 by Jelmer Vernooij
Fix info tests.
318
Control directory:
319
         1 branches
320
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
321
In the working tree:
322
         1 unchanged
323
         0 modified
324
         0 added
325
         0 removed
326
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
327
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
328
         0 unknown
329
         0 ignored
330
         0 versioned subdirectories
331
332
Branch history:
333
         1 revision
334
         0 days old
335
   first revision: %s
336
  latest revision: %s
337
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
338
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
339
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
340
""" % (branch4.repository._format.get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
341
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
342
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
343
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
344
345
        # Lightweight checkout (same as above, different branch and repository)
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
346
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
347
        branch5 = tree5.branch
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
348
        out, err = self.run_bzr('info -v lightcheckout')
6472.2.1 by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories.
349
        if "metaweave" in controldir.format_registry:
5728.2.1 by Jelmer Vernooij
Fix bb.test_info with both --no-plugins and without --no-plugins.
350
            format_description = "knit or metaweave"
351
        else:
352
            format_description = "knit"
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
353
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
354
            """Lightweight checkout (format: %s)
2363.5.3 by Aaron Bentley
Add layout description to info output
355
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
356
  light checkout root: lightcheckout
357
   checkout of branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
358
359
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
360
       control: Meta directory format 1
5582.10.91 by Jelmer Vernooij
Fix some tests.
361
  working tree: Working tree format 3
362
        branch: Branch format 5
363
    repository: Knit repository format 1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
364
6437.21.4 by Jelmer Vernooij
Fix info tests.
365
Control directory:
366
         1 branches
367
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
368
In the working tree:
369
         1 unchanged
370
         0 modified
371
         0 added
372
         0 removed
373
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
374
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
375
         0 unknown
376
         0 ignored
377
         0 versioned subdirectories
378
379
Branch history:
380
         1 revision
381
         0 days old
382
   first revision: %s
383
  latest revision: %s
384
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
385
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
386
         1 revision
5728.2.1 by Jelmer Vernooij
Fix bb.test_info with both --no-plugins and without --no-plugins.
387
""" % (format_description, datestring_first, datestring_first,), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
388
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
389
390
        # Update initial standalone branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
391
        self.build_tree(['standalone/b'])
392
        tree1.add('b')
393
        tree1.commit('commit two')
6165.4.1 by Jelmer Vernooij
Avoid using revision_history.
394
        rev = branch1.repository.get_revision(branch1.last_revision())
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
395
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
396
397
        # Out of date branched standalone branch will not be detected
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
398
        out, err = self.run_bzr('info -v branch')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
399
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
400
            """Standalone tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
401
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
402
  branch root: branch
1694.2.6 by Martin Pool
[merge] bzr.dev
403
404
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
405
    push branch: standalone
406
  parent branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
407
408
Format:
5582.10.91 by Jelmer Vernooij
Fix some tests.
409
       control: Meta directory format 1
410
  working tree: Working tree format 3
411
        branch: Branch format 5
412
    repository: Knit repository format 1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
413
6437.21.4 by Jelmer Vernooij
Fix info tests.
414
Control directory:
415
         1 branches
416
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
417
In the working tree:
418
         1 unchanged
419
         0 modified
420
         0 added
421
         0 removed
422
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
423
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
424
         0 unknown
425
         0 ignored
426
         0 versioned subdirectories
427
428
Branch history:
429
         1 revision
430
         0 days old
431
   first revision: %s
432
  latest revision: %s
433
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
434
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
435
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
436
""" % (datestring_first, datestring_first,
1694.2.6 by Martin Pool
[merge] bzr.dev
437
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
438
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
439
440
        # Out of date bound branch
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
441
        out, err = self.run_bzr('info -v bound')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
442
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
443
            """Checkout (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
444
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
445
       checkout root: bound
446
  checkout of branch: standalone
1694.2.6 by Martin Pool
[merge] bzr.dev
447
448
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
449
  parent branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
450
451
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
452
       control: Meta directory format 1
453
  working tree: Working tree format 3
454
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
455
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
456
6437.21.4 by Jelmer Vernooij
Fix info tests.
457
Control directory:
458
         1 branches
459
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
460
Branch is out of date: missing 1 revision.
461
462
In the working tree:
463
         1 unchanged
464
         0 modified
465
         0 added
466
         0 removed
467
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
468
         0 copied
5035.4.8 by Martin Pool
Update info tests to cope with backup.bzr being ignored
469
         0 unknown
5582.10.91 by Jelmer Vernooij
Fix some tests.
470
         0 ignored
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
471
         0 versioned subdirectories
472
473
Branch history:
474
         1 revision
475
         0 days old
476
   first revision: %s
477
  latest revision: %s
478
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
479
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
480
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
481
""" % (branch3.repository._format.get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
482
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
483
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
484
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
485
486
        # Out of date checkout
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
487
        out, err = self.run_bzr('info -v checkout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
488
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
489
            """Checkout (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
490
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
491
       checkout root: checkout
492
  checkout of branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
493
494
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
495
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
496
  working tree: Working tree format 3
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
497
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
498
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
499
6437.21.4 by Jelmer Vernooij
Fix info tests.
500
Control directory:
501
         1 branches
502
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
503
Branch is out of date: missing 1 revision.
504
505
In the working tree:
506
         1 unchanged
507
         0 modified
508
         0 added
509
         0 removed
510
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
511
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
512
         0 unknown
513
         0 ignored
514
         0 versioned subdirectories
515
516
Branch history:
517
         1 revision
518
         0 days old
519
   first revision: %s
520
  latest revision: %s
521
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
522
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
523
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
524
""" % (branch4.repository._format.get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
525
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
526
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
527
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
528
529
        # Out of date lightweight checkout
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
530
        out, err = self.run_bzr('info lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
531
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
532
            """Lightweight checkout (format: %s)
2363.5.3 by Aaron Bentley
Add layout description to info output
533
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
534
  light checkout root: lightcheckout
535
   checkout of branch: standalone
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
536
537
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
538
       control: Meta directory format 1
5582.10.91 by Jelmer Vernooij
Fix some tests.
539
  working tree: Working tree format 3
540
        branch: Branch format 5
541
    repository: Knit repository format 1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
542
6437.21.4 by Jelmer Vernooij
Fix info tests.
543
Control directory:
544
         1 branches
545
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
546
Working tree is out of date: missing 1 revision.
547
548
In the working tree:
549
         1 unchanged
550
         0 modified
551
         0 added
552
         0 removed
553
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
554
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
555
         0 unknown
556
         0 ignored
557
         0 versioned subdirectories
558
559
Branch history:
560
         2 revisions
561
         0 days old
562
   first revision: %s
563
  latest revision: %s
564
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
565
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
566
         2 revisions
5728.2.1 by Jelmer Vernooij
Fix bb.test_info with both --no-plugins and without --no-plugins.
567
""" % (format_description, datestring_first, datestring_last,), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
568
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
569
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
570
    def test_info_standalone_no_tree(self):
571
        # create standalone branch without a working tree
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
572
        format = controldir.format_registry.make_controldir('default')
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
573
        branch = self.make_branch('branch')
574
        repo = branch.repository
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
575
        out, err = self.run_bzr('info branch -v')
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
576
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
577
            """Standalone branch (format: %s)
2363.5.3 by Aaron Bentley
Add layout description to info output
578
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
579
  branch root: branch
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
580
581
Format:
582
       control: Meta directory format 1
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
583
        branch: %s
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
584
    repository: %s
585
6437.21.4 by Jelmer Vernooij
Fix info tests.
586
Control directory:
587
         1 branches
588
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
589
Branch history:
590
         0 revisions
591
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
592
Repository:
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
593
         0 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
594
""" % (info.describe_format(repo.controldir, repo, branch, None),
7143.15.2 by Jelmer Vernooij
Run autopep8.
595
                format.get_branch_format().get_format_description(),
596
                format.repository_format.get_format_description(),
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
597
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
598
        self.assertEqual('', err)
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
599
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
600
    def test_info_shared_repository(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
601
        format = controldir.format_registry.make_controldir('knit')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
602
        transport = self.get_transport()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
603
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
604
        # Create shared repository
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
605
        repo = self.make_repository('repo', shared=True, format=format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
606
        repo.set_make_working_trees(False)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
607
        out, err = self.run_bzr('info -v repo')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
608
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
609
            """Shared repository (format: dirstate or dirstate-tags or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
610
Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
611
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
612
613
Format:
614
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
615
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
616
6437.21.4 by Jelmer Vernooij
Fix info tests.
617
Control directory:
618
         0 branches
619
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
620
Repository:
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
621
         0 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
622
""" % ('repo', format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
623
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
624
        self.assertEqual('', err)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
625
626
        # Create branch inside shared repository
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
627
        repo.controldir.root_transport.mkdir('branch')
6207.3.8 by Jelmer Vernooij
Fix a bunch of tests.
628
        branch1 = controldir.ControlDir.create_branch_convenience(
629
            'repo/branch', format=format)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
630
        out, err = self.run_bzr('info -v repo/branch')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
631
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
632
            """Repository branch (format: dirstate or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
633
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
634
  shared repository: repo
635
  repository branch: repo/branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
636
637
Format:
638
       control: Meta directory format 1
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
639
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
640
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
641
6437.21.4 by Jelmer Vernooij
Fix info tests.
642
Control directory:
643
         1 branches
644
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
645
Branch history:
646
         0 revisions
647
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
648
Repository:
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
649
         0 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
650
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
651
                format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
652
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
653
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
654
655
        # Create lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
656
        transport.mkdir('tree')
657
        transport.mkdir('tree/lightcheckout')
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
658
        tree2 = branch1.create_checkout('tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
659
                                        lightweight=True)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
660
        branch2 = tree2.branch
2363.5.11 by Aaron Bentley
All info tests pass
661
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
7143.15.2 by Jelmer Vernooij
Run autopep8.
662
                                        shared_repo=repo, repo_branch=branch1, verbose=True)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
663
664
        # Create normal checkout
1551.8.5 by Aaron Bentley
Change name to create_checkout
665
        tree3 = branch1.create_checkout('tree/checkout')
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
666
        self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
7143.15.2 by Jelmer Vernooij
Run autopep8.
667
                                        verbose=True,
668
                                        light_checkout=False, repo_branch=branch1)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
669
        # Update lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
670
        self.build_tree(['tree/lightcheckout/a'])
671
        tree2.add('a')
672
        tree2.commit('commit one')
6165.4.1 by Jelmer Vernooij
Avoid using revision_history.
673
        rev = repo.get_revision(branch2.last_revision())
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
674
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
675
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
676
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
677
            """Lightweight checkout (format: %s)
2363.5.3 by Aaron Bentley
Add layout description to info output
678
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
679
  light checkout root: tree/lightcheckout
680
   checkout of branch: repo/branch
681
    shared repository: repo
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
682
683
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
684
       control: Meta directory format 1
4599.4.7 by Robert Collins
Update blackbox.test_info tests for 2a as default.
685
  working tree: Working tree format 6
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
686
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
687
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
688
6437.21.4 by Jelmer Vernooij
Fix info tests.
689
Control directory:
690
         1 branches
691
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
692
In the working tree:
693
         1 unchanged
694
         0 modified
695
         0 added
696
         0 removed
697
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
698
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
699
         0 unknown
700
         0 ignored
701
         0 versioned subdirectories
702
703
Branch history:
704
         1 revision
705
         0 days old
706
   first revision: %s
707
  latest revision: %s
708
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
709
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
710
         1 revision
4599.3.1 by Robert Collins
Factor out some string duplication from blackbox.test_info to make changing the default format easier.
711
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
712
                format.repository_format.get_format_description(),
713
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
714
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
715
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
716
717
        # Out of date checkout
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
718
        out, err = self.run_bzr('info -v tree/checkout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
719
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
720
            """Checkout (format: unnamed)
2363.5.3 by Aaron Bentley
Add layout description to info output
721
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
722
       checkout root: tree/checkout
723
  checkout of branch: repo/branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
724
725
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
726
       control: Meta directory format 1
4599.4.7 by Robert Collins
Update blackbox.test_info tests for 2a as default.
727
  working tree: Working tree format 6
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
728
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
729
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
730
6437.21.4 by Jelmer Vernooij
Fix info tests.
731
Control directory:
732
         1 branches
733
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
734
Branch is out of date: missing 1 revision.
735
736
In the working tree:
737
         0 unchanged
738
         0 modified
739
         0 added
740
         0 removed
741
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
742
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
743
         0 unknown
744
         0 ignored
745
         0 versioned subdirectories
746
747
Branch history:
748
         0 revisions
749
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
750
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
751
         0 revisions
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
752
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
753
                format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
754
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
755
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
756
757
        # Update checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
758
        tree3.update()
759
        self.build_tree(['tree/checkout/b'])
760
        tree3.add('b')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
761
        out, err = self.run_bzr('info tree/checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
762
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
763
            """Checkout (format: unnamed)
2363.5.3 by Aaron Bentley
Add layout description to info output
764
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
765
       checkout root: tree/checkout
766
  checkout of branch: repo/branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
767
768
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
769
       control: Meta directory format 1
4599.4.7 by Robert Collins
Update blackbox.test_info tests for 2a as default.
770
  working tree: Working tree format 6
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
771
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
772
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
773
6437.21.4 by Jelmer Vernooij
Fix info tests.
774
Control directory:
775
         1 branches
776
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
777
In the working tree:
778
         1 unchanged
779
         0 modified
780
         1 added
781
         0 removed
782
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
783
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
784
         0 unknown
785
         0 ignored
786
         0 versioned subdirectories
787
788
Branch history:
789
         1 revision
790
         0 days old
791
   first revision: %s
792
  latest revision: %s
793
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
794
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
795
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
796
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
797
                format.repository_format.get_format_description(),
798
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
799
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
800
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
801
        tree3.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
802
803
        # Out of date lightweight checkout
6165.4.1 by Jelmer Vernooij
Avoid using revision_history.
804
        rev = repo.get_revision(branch1.last_revision())
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
805
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
806
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
807
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
808
            """Lightweight checkout (format: %s)
2363.5.3 by Aaron Bentley
Add layout description to info output
809
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
810
  light checkout root: tree/lightcheckout
811
   checkout of branch: repo/branch
812
    shared repository: repo
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
813
814
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
815
       control: Meta directory format 1
4599.4.7 by Robert Collins
Update blackbox.test_info tests for 2a as default.
816
  working tree: Working tree format 6
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
817
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
818
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
819
6437.21.4 by Jelmer Vernooij
Fix info tests.
820
Control directory:
821
         1 branches
822
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
823
Working tree is out of date: missing 1 revision.
824
825
In the working tree:
826
         1 unchanged
827
         0 modified
828
         0 added
829
         0 removed
830
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
831
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
832
         0 unknown
833
         0 ignored
834
         0 versioned subdirectories
835
836
Branch history:
837
         2 revisions
838
         0 days old
839
   first revision: %s
840
  latest revision: %s
841
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
842
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
843
         2 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
844
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
845
                format.repository_format.get_format_description(),
846
                datestring_first, datestring_last,
1666.1.6 by Robert Collins
Make knit the default format.
847
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
848
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
849
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
850
        # Show info about shared branch
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
851
        out, err = self.run_bzr('info repo/branch --verbose')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
852
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
853
            """Repository branch (format: dirstate or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
854
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
855
  shared repository: repo
856
  repository branch: repo/branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
857
858
Format:
859
       control: Meta directory format 1
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
860
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
861
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
862
6437.21.4 by Jelmer Vernooij
Fix info tests.
863
Control directory:
864
         1 branches
865
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
866
Branch history:
867
         2 revisions
868
         0 days old
869
   first revision: %s
870
  latest revision: %s
871
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
872
Repository:
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
873
         2 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
874
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
875
                format.repository_format.get_format_description(),
876
                datestring_first, datestring_last,
1666.1.6 by Robert Collins
Make knit the default format.
877
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
878
        self.assertEqual('', err)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
879
880
        # Show info about repository with revisions
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
881
        out, err = self.run_bzr('info -v repo')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
882
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
883
            """Shared repository (format: dirstate or dirstate-tags or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
884
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
885
  shared repository: repo
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
886
887
Format:
888
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
889
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
890
6437.21.4 by Jelmer Vernooij
Fix info tests.
891
Control directory:
892
         0 branches
893
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
894
Repository:
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
895
         2 revisions
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
896
""" % (format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
897
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
898
        self.assertEqual('', err)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
899
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
900
    def test_info_shared_repository_with_trees(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
901
        format = controldir.format_registry.make_controldir('knit')
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
902
        transport = self.get_transport()
903
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
904
        # Create shared repository with working trees
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
905
        repo = self.make_repository('repo', shared=True, format=format)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
906
        repo.set_make_working_trees(True)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
907
        out, err = self.run_bzr('info -v repo')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
908
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
909
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
910
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
911
  shared repository: repo
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
912
913
Format:
914
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
915
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
916
6437.21.4 by Jelmer Vernooij
Fix info tests.
917
Control directory:
918
         0 branches
919
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
920
Create working tree for new branches inside the repository.
921
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
922
Repository:
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
923
         0 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
924
""" % (format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
925
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
926
        self.assertEqual('', err)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
927
928
        # Create two branches
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
929
        repo.controldir.root_transport.mkdir('branch1')
6207.3.3 by jelmer at samba
Fix tests and the like.
930
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
7143.15.2 by Jelmer Vernooij
Run autopep8.
931
                                                                  format=format)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
932
        branch2 = branch1.controldir.sprout('repo/branch2').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
933
934
        # Empty first branch
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
935
        out, err = self.run_bzr('info repo/branch1 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
936
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
937
            """Repository tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
938
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
939
  shared repository: repo
940
  repository branch: repo/branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
941
942
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
943
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
944
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
945
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
946
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
947
6437.21.4 by Jelmer Vernooij
Fix info tests.
948
Control directory:
949
         1 branches
950
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
951
In the working tree:
952
         0 unchanged
953
         0 modified
954
         0 added
955
         0 removed
956
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
957
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
958
         0 unknown
959
         0 ignored
960
         0 versioned subdirectories
961
962
Branch history:
963
         0 revisions
964
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
965
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
966
         0 revisions
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
967
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
968
                format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
969
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
970
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
971
972
        # Update first branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
973
        self.build_tree(['repo/branch1/a'])
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
974
        tree1 = branch1.controldir.open_workingtree()
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
975
        tree1.add('a')
976
        tree1.commit('commit one')
6165.4.1 by Jelmer Vernooij
Avoid using revision_history.
977
        rev = repo.get_revision(branch1.last_revision())
5010.2.2 by Vincent Ladeuil
Fix blackbox/test_infp.py imports.
978
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
979
        out, err = self.run_bzr('info -v repo/branch1')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
980
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
981
            """Repository tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
982
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
983
  shared repository: repo
984
  repository branch: repo/branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
985
986
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
987
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
988
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
989
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
990
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
991
6437.21.4 by Jelmer Vernooij
Fix info tests.
992
Control directory:
993
         1 branches
994
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
995
In the working tree:
996
         1 unchanged
997
         0 modified
998
         0 added
999
         0 removed
1000
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
1001
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1002
         0 unknown
1003
         0 ignored
1004
         0 versioned subdirectories
1005
1006
Branch history:
1007
         1 revision
1008
         0 days old
1009
   first revision: %s
1010
  latest revision: %s
1011
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1012
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1013
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1014
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
1015
                format.repository_format.get_format_description(),
1016
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
1017
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1018
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1019
1020
        # Out of date second branch
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
1021
        out, err = self.run_bzr('info repo/branch2 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1022
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1023
            """Repository tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
1024
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1025
  shared repository: repo
1026
  repository branch: repo/branch2
1694.2.6 by Martin Pool
[merge] bzr.dev
1027
1028
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1029
  parent branch: repo/branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1030
1031
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
1032
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
1033
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1034
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
1035
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1036
6437.21.4 by Jelmer Vernooij
Fix info tests.
1037
Control directory:
1038
         1 branches
1039
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1040
In the working tree:
1041
         0 unchanged
1042
         0 modified
1043
         0 added
1044
         0 removed
1045
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
1046
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1047
         0 unknown
1048
         0 ignored
1049
         0 versioned subdirectories
1050
1051
Branch history:
1052
         0 revisions
1053
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1054
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1055
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1056
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
1057
                format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
1058
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1059
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1060
1061
        # Update second branch
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1062
        tree2 = branch2.controldir.open_workingtree()
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
1063
        tree2.pull(branch1)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
1064
        out, err = self.run_bzr('info -v repo/branch2')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1065
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1066
            """Repository tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
1067
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1068
  shared repository: repo
1069
  repository branch: repo/branch2
1694.2.6 by Martin Pool
[merge] bzr.dev
1070
1071
Related branches:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1072
  parent branch: repo/branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1073
1074
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
1075
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
1076
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1077
        branch: %s
1666.1.6 by Robert Collins
Make knit the default format.
1078
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1079
6437.21.4 by Jelmer Vernooij
Fix info tests.
1080
Control directory:
1081
         1 branches
1082
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1083
In the working tree:
1084
         1 unchanged
1085
         0 modified
1086
         0 added
1087
         0 removed
1088
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
1089
         0 copied
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1090
         0 unknown
1091
         0 ignored
1092
         0 versioned subdirectories
1093
1094
Branch history:
1095
         1 revision
1096
         0 days old
1097
   first revision: %s
1098
  latest revision: %s
1099
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1100
Repository:
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1101
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1102
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
1103
                format.repository_format.get_format_description(),
1104
                datestring_first, datestring_first,
1666.1.6 by Robert Collins
Make knit the default format.
1105
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1106
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
1107
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1108
        # Show info about repository with revisions
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
1109
        out, err = self.run_bzr('info -v repo')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1110
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1111
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
1112
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1113
  shared repository: repo
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1114
1115
Format:
1116
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
1117
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1118
6437.21.4 by Jelmer Vernooij
Fix info tests.
1119
Control directory:
1120
         0 branches
1121
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1122
Create working tree for new branches inside the repository.
1123
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1124
Repository:
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1125
         1 revision
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1126
""" % (format.repository_format.get_format_description(),
1666.1.6 by Robert Collins
Make knit the default format.
1127
       ),
7143.15.2 by Jelmer Vernooij
Run autopep8.
1128
            out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1129
        self.assertEqual('', err)
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
1130
1694.2.6 by Martin Pool
[merge] bzr.dev
1131
    def test_info_shared_repository_with_tree_in_root(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
1132
        format = controldir.format_registry.make_controldir('knit')
1694.2.6 by Martin Pool
[merge] bzr.dev
1133
        transport = self.get_transport()
1134
1135
        # Create shared repository with working trees
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
1136
        repo = self.make_repository('repo', shared=True, format=format)
1694.2.6 by Martin Pool
[merge] bzr.dev
1137
        repo.set_make_working_trees(True)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
1138
        out, err = self.run_bzr('info -v repo')
1694.2.6 by Martin Pool
[merge] bzr.dev
1139
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1140
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
1141
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1142
  shared repository: repo
1694.2.6 by Martin Pool
[merge] bzr.dev
1143
1144
Format:
1145
       control: Meta directory format 1
1146
    repository: %s
1147
6437.21.4 by Jelmer Vernooij
Fix info tests.
1148
Control directory:
1149
         0 branches
1150
1694.2.6 by Martin Pool
[merge] bzr.dev
1151
Create working tree for new branches inside the repository.
1152
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1153
Repository:
1694.2.6 by Martin Pool
[merge] bzr.dev
1154
         0 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1155
""" % (format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
1156
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1157
        self.assertEqual('', err)
1694.2.6 by Martin Pool
[merge] bzr.dev
1158
1159
        # Create branch in root of repository
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1160
        control = repo.controldir
1694.2.6 by Martin Pool
[merge] bzr.dev
1161
        branch = control.create_branch()
1162
        control.create_workingtree()
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
1163
        out, err = self.run_bzr('info -v repo')
1694.2.6 by Martin Pool
[merge] bzr.dev
1164
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1165
            """Repository tree (format: knit)
2363.5.3 by Aaron Bentley
Add layout description to info output
1166
Location:
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1167
  shared repository: repo
1168
  repository branch: repo
1694.2.6 by Martin Pool
[merge] bzr.dev
1169
1170
Format:
1171
       control: Meta directory format 1
2255.2.201 by Robert Collins
Test_info needed updating after freezing the meaning of 'knit' format dirs.
1172
  working tree: Working tree format 3
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1173
        branch: %s
1694.2.6 by Martin Pool
[merge] bzr.dev
1174
    repository: %s
1175
6437.21.4 by Jelmer Vernooij
Fix info tests.
1176
Control directory:
1177
         1 branches
1178
1694.2.6 by Martin Pool
[merge] bzr.dev
1179
In the working tree:
1180
         0 unchanged
1181
         0 modified
1182
         0 added
1183
         0 removed
1184
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
1185
         0 copied
1694.2.6 by Martin Pool
[merge] bzr.dev
1186
         0 unknown
1187
         0 ignored
1188
         0 versioned subdirectories
1189
1190
Branch history:
1191
         0 revisions
1192
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1193
Repository:
1694.2.6 by Martin Pool
[merge] bzr.dev
1194
         0 revisions
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1195
""" % (format.get_branch_format().get_format_description(),
7143.15.2 by Jelmer Vernooij
Run autopep8.
1196
                format.repository_format.get_format_description(),
1694.2.6 by Martin Pool
[merge] bzr.dev
1197
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1198
        self.assertEqual('', err)
1694.2.6 by Martin Pool
[merge] bzr.dev
1199
4307.3.2 by Jelmer Vernooij
Add tests for the repository info hook.
1200
    def test_info_repository_hook(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
1201
        format = controldir.format_registry.make_controldir('knit')
7143.15.2 by Jelmer Vernooij
Run autopep8.
1202
4307.3.3 by Jelmer Vernooij
Add repository argument to 'repository' info hook, per Roberts review.
1203
        def repo_info(repo, stats, outf):
6985 by Jelmer Vernooij
Merge lp:~jelmer/brz/python3-weave-fmt.
1204
            outf.write(u"more info\n")
4307.3.2 by Jelmer Vernooij
Add tests for the repository info hook.
1205
        info.hooks.install_named_hook('repository', repo_info, None)
1206
        # Create shared repository with working trees
1207
        repo = self.make_repository('repo', shared=True, format=format)
1208
        out, err = self.run_bzr('info -v repo')
1209
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1210
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
4307.3.2 by Jelmer Vernooij
Add tests for the repository info hook.
1211
Location:
1212
  shared repository: repo
1213
1214
Format:
1215
       control: Meta directory format 1
1216
    repository: %s
1217
6437.21.4 by Jelmer Vernooij
Fix info tests.
1218
Control directory:
1219
         0 branches
1220
4307.3.2 by Jelmer Vernooij
Add tests for the repository info hook.
1221
Create working tree for new branches inside the repository.
1222
1223
Repository:
1224
         0 revisions
1225
more info
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1226
""" % (format.repository_format.get_format_description(),
4307.3.2 by Jelmer Vernooij
Add tests for the repository info hook.
1227
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1228
        self.assertEqual('', err)
4307.3.2 by Jelmer Vernooij
Add tests for the repository info hook.
1229
6437.9.1 by Jelmer Vernooij
Report present but unused colocated branches in `bzr info`.
1230
    def test_info_unshared_repository_with_colocated_branches(self):
6653.6.5 by Jelmer Vernooij
Rename make_bzrdir to make_controldir.
1231
        format = controldir.format_registry.make_controldir('development-colo')
6437.9.1 by Jelmer Vernooij
Report present but unused colocated branches in `bzr info`.
1232
        transport = self.get_transport()
1233
6437.9.2 by Jelmer Vernooij
Fix typo in comment.
1234
        # Create unshared repository
6437.9.1 by Jelmer Vernooij
Report present but unused colocated branches in `bzr info`.
1235
        repo = self.make_repository('repo', shared=False, format=format)
1236
        repo.set_make_working_trees(True)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1237
        repo.controldir.create_branch(name='foo')
6437.9.1 by Jelmer Vernooij
Report present but unused colocated branches in `bzr info`.
1238
        out, err = self.run_bzr('info repo')
1239
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1240
            """Unshared repository with trees and colocated branches (format: development-colo)
6437.9.1 by Jelmer Vernooij
Report present but unused colocated branches in `bzr info`.
1241
Location:
1242
  repository: repo
1243
""", out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1244
        self.assertEqual('', err)
6437.9.1 by Jelmer Vernooij
Report present but unused colocated branches in `bzr info`.
1245
3010.1.13 by Robert Collins
Use the info code functions to determine format strings in the blackbox tests, and handle repositories that do not lock like packs.
1246
    def assertCheckoutStatusOutput(self,
7143.15.2 by Jelmer Vernooij
Run autopep8.
1247
                                   command_string, lco_tree, shared_repo=None,
1248
                                   repo_branch=None,
1249
                                   tree_locked=False,
1250
                                   branch_locked=False, repo_locked=False,
1251
                                   verbose=False,
1252
                                   light_checkout=True,
1253
                                   checkout_root=None):
2363.5.18 by Aaron Bentley
Get all tests passing
1254
        """Check the output of info in a checkout.
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1255
1256
        This is not quite a mirror of the info code: rather than using the
1257
        tree being examined to predict output, it uses a bunch of flags which
1258
        allow us, the test writers, to document what *should* be present in
1259
        the output. Removing this separation would remove the value of the
1260
        tests.
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
1261
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1262
        :param path: the path to the light checkout.
1263
        :param lco_tree: the tree object for the light checkout.
1264
        :param shared_repo: A shared repository is in use, expect that in
1265
            the output.
1266
        :param repo_branch: A branch in a shared repository for non light
1267
            checkouts.
1268
        :param tree_locked: If true, expect the tree to be locked.
1269
        :param branch_locked: If true, expect the branch to be locked.
1270
        :param repo_locked: If true, expect the repository to be locked.
3010.1.13 by Robert Collins
Use the info code functions to determine format strings in the blackbox tests, and handle repositories that do not lock like packs.
1271
            Note that the lco_tree.branch.repository is inspected, and if is not
1272
            actually locked then this parameter is overridden. This is because
1273
            pack repositories do not have any public API for obtaining an
1274
            exclusive repository wide lock.
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
1275
        :param verbose: verbosity level: 2 or higher to show committers
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1276
        """
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1277
        def friendly_location(url):
1278
            path = urlutils.unescape_for_display(url, 'ascii')
1279
            try:
2804.4.3 by Alexander Belchenko
fix for test_info-tests: using osutils.getcwd instead of os.getcwd (sigh)
1280
                return osutils.relpath(osutils.getcwd(), path)
1551.15.41 by Aaron Bentley
Make info provide more related brances, and format all branches nicely
1281
            except errors.PathNotChild:
1282
                return path
1283
3113.5.1 by Alexander Belchenko
XFAIL test for #174055: can't run bzr info while dirstate is locked
1284
        if tree_locked:
1285
            # We expect this to fail because of locking errors.
1286
            # (A write-locked file cannot be read-locked
1287
            # in the different process -- either on win32 or on linux).
2425.3.3 by John Arbash Meinel
Update comment according to Martin
1288
            # This should be removed when the locking errors are fixed.
3113.5.1 by Alexander Belchenko
XFAIL test for #174055: can't run bzr info while dirstate is locked
1289
            self.expectFailure('OS locks are exclusive '
7143.15.2 by Jelmer Vernooij
Run autopep8.
1290
                               'for different processes (Bug #174055)',
1291
                               self.run_bzr_subprocess,
1292
                               'info ' + command_string)
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
1293
        out, err = self.run_bzr('info %s' % command_string)
2363.5.3 by Aaron Bentley
Add layout description to info output
1294
        description = {
2363.5.4 by Aaron Bentley
Eliminate the concept of a 'repository lightweight checkout'
1295
            (True, True): 'Lightweight checkout',
2363.5.3 by Aaron Bentley
Add layout description to info output
1296
            (True, False): 'Repository checkout',
1297
            (False, True): 'Lightweight checkout',
1298
            (False, False): 'Checkout',
1299
            }[(shared_repo is not None, light_checkout)]
4599.3.1 by Robert Collins
Factor out some string duplication from blackbox.test_info to make changing the default format easier.
1300
        format = {True: self._repo_strings,
4599.4.7 by Robert Collins
Update blackbox.test_info tests for 2a as default.
1301
                  False: 'unnamed'}[light_checkout]
3010.1.13 by Robert Collins
Use the info code functions to determine format strings in the blackbox tests, and handle repositories that do not lock like packs.
1302
        if repo_locked:
1303
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1304
        if repo_locked or branch_locked or tree_locked:
1305
            def locked_message(a_bool):
1306
                if a_bool:
1307
                    return 'locked'
1308
                else:
1309
                    return 'unlocked'
1310
            expected_lock_output = (
1311
                "\n"
1312
                "Lock status:\n"
1313
                "  working tree: %s\n"
1314
                "        branch: %s\n"
1315
                "    repository: %s\n" % (
1316
                    locked_message(tree_locked),
1317
                    locked_message(branch_locked),
1318
                    locked_message(repo_locked)))
1319
        else:
1320
            expected_lock_output = ''
2363.5.18 by Aaron Bentley
Get all tests passing
1321
        tree_data = ''
1322
        extra_space = ''
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1323
        if light_checkout:
2363.5.18 by Aaron Bentley
Get all tests passing
1324
            tree_data = ("  light checkout root: %s\n" %
7143.15.2 by Jelmer Vernooij
Run autopep8.
1325
                         friendly_location(lco_tree.controldir.root_transport.base))
2363.5.18 by Aaron Bentley
Get all tests passing
1326
            extra_space = ' '
1327
        if lco_tree.branch.get_bound_location() is not None:
1328
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
7143.15.2 by Jelmer Vernooij
Run autopep8.
1329
                                                            friendly_location(lco_tree.branch.controldir.root_transport.base)))
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1330
        if shared_repo is not None:
1331
            branch_data = (
2363.5.18 by Aaron Bentley
Get all tests passing
1332
                "   checkout of branch: %s\n"
1333
                "    shared repository: %s\n" %
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1334
                (friendly_location(repo_branch.controldir.root_transport.base),
1335
                 friendly_location(shared_repo.controldir.root_transport.base)))
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1336
        elif repo_branch is not None:
1337
            branch_data = (
2363.5.18 by Aaron Bentley
Get all tests passing
1338
                "%s  checkout of branch: %s\n" %
1339
                (extra_space,
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1340
                 friendly_location(repo_branch.controldir.root_transport.base)))
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1341
        else:
2363.5.18 by Aaron Bentley
Get all tests passing
1342
            branch_data = ("   checkout of branch: %s\n" %
7143.15.2 by Jelmer Vernooij
Run autopep8.
1343
                           lco_tree.branch.controldir.root_transport.base)
4035.1.2 by Ian Clatworthy
clean-up trailing whitespace
1344
4032.2.1 by Ian Clatworthy
omit branch committers from info -v (now requires -vv)
1345
        if verbose >= 2:
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1346
            verbose_info = '         0 committers\n'
1347
        else:
1348
            verbose_info = ''
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
1349
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1350
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1351
            """%s (format: %s)
2363.5.3 by Aaron Bentley
Add layout description to info output
1352
Location:
2363.5.18 by Aaron Bentley
Get all tests passing
1353
%s%s
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1354
Format:
1355
       control: Meta directory format 1
1356
  working tree: %s
2230.3.13 by Aaron Bentley
Fix most info tests (but some depend on odd cloning behavior)
1357
        branch: %s
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1358
    repository: %s
1359
%s
6437.21.4 by Jelmer Vernooij
Fix info tests.
1360
Control directory:
1361
         1 branches
1362
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1363
In the working tree:
1364
         0 unchanged
1365
         0 modified
1366
         0 added
1367
         0 removed
1368
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
1369
         0 copied
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1370
         0 unknown
1371
         0 ignored
1372
         0 versioned subdirectories
1373
1374
Branch history:
1375
         0 revisions
1376
%s
2395.1.1 by Martin Pool
rename 'revision store' to 'repository' in bzr info
1377
Repository:
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1378
         0 revisions
7143.15.2 by Jelmer Vernooij
Run autopep8.
1379
""" % (description,
1380
                format,
1381
                tree_data,
1382
                branch_data,
1383
                lco_tree._format.get_format_description(),
1384
                lco_tree.branch._format.get_format_description(),
1385
                lco_tree.branch.repository._format.get_format_description(),
1386
                expected_lock_output,
1387
                verbose_info,
1388
       ), out)
7027.4.1 by Jelmer Vernooij
Use StringIOWithEncoding on Python3.
1389
        self.assertEqual('', err)
1780.1.2 by Robert Collins
(robertc)Partial refactoring of info tests to be more robust to format changes.
1390
1694.2.6 by Martin Pool
[merge] bzr.dev
1391
    def test_info_locking(self):
1392
        transport = self.get_transport()
1393
        # Create shared repository with a branch
1394
        repo = self.make_repository('repo', shared=True,
3575.1.1 by Andrew Bennetts
Tidy imports in blackbox.test_info, fixing trivial test failure caused by a missing import.
1395
                                    format=bzrdir.BzrDirMetaFormat1())
1694.2.6 by Martin Pool
[merge] bzr.dev
1396
        repo.set_make_working_trees(False)
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1397
        repo.controldir.root_transport.mkdir('branch')
6207.3.3 by jelmer at samba
Fix tests and the like.
1398
        repo_branch = controldir.ControlDir.create_branch_convenience(
1399
            'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1694.2.6 by Martin Pool
[merge] bzr.dev
1400
        # Do a heavy checkout
1401
        transport.mkdir('tree')
1402
        transport.mkdir('tree/checkout')
6207.3.8 by Jelmer Vernooij
Fix a bunch of tests.
1403
        co_branch = controldir.ControlDir.create_branch_convenience(
1404
            'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1694.2.6 by Martin Pool
[merge] bzr.dev
1405
        co_branch.bind(repo_branch)
1406
        # Do a light checkout of the heavy one
1407
        transport.mkdir('tree/lightcheckout')
3575.1.1 by Andrew Bennetts
Tidy imports in blackbox.test_info, fixing trivial test failure caused by a missing import.
1408
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
6437.7.3 by Jelmer Vernooij
Use ControlDir.set_branch_reference.
1409
        lco_dir.set_branch_reference(co_branch)
1694.2.6 by Martin Pool
[merge] bzr.dev
1410
        lco_dir.create_workingtree()
1411
        lco_tree = lco_dir.open_workingtree()
1412
1413
        # Test all permutations of locking the working tree, branch and repository
1414
        # W B R
1415
1416
        # U U U
2363.5.11 by Aaron Bentley
All info tests pass
1417
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
2363.5.18 by Aaron Bentley
Get all tests passing
1418
                                        repo_branch=repo_branch,
1419
                                        verbose=True, light_checkout=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1420
        # U U L
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1421
        with lco_tree.branch.repository.lock_write():
2363.5.11 by Aaron Bentley
All info tests pass
1422
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1423
                                            lco_tree, repo_branch=repo_branch,
1424
                                            repo_locked=True, verbose=True, light_checkout=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1425
        # U L L
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1426
        with lco_tree.branch.lock_write():
2363.5.11 by Aaron Bentley
All info tests pass
1427
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1428
                                            lco_tree,
1429
                                            branch_locked=True,
1430
                                            repo_locked=True,
1431
                                            repo_branch=repo_branch,
1432
                                            verbose=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1433
        # L L L
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1434
        with lco_tree.lock_write():
2363.5.11 by Aaron Bentley
All info tests pass
1435
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1436
                                            lco_tree, repo_branch=repo_branch,
1437
                                            tree_locked=True,
1438
                                            branch_locked=True,
1439
                                            repo_locked=True,
1440
                                            verbose=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1441
        # L L U
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1442
        with lco_tree.lock_write(), lco_tree.branch.repository.unlock():
2363.5.11 by Aaron Bentley
All info tests pass
1443
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1444
                                            lco_tree, repo_branch=repo_branch,
1445
                                            tree_locked=True,
1446
                                            branch_locked=True,
1447
                                            verbose=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1448
        # L U U
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1449
        with lco_tree.lock_write(), lco_tree.branch.unlock():
2363.5.11 by Aaron Bentley
All info tests pass
1450
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1451
                                            lco_tree, repo_branch=repo_branch,
1452
                                            tree_locked=True,
1453
                                            verbose=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1454
        # L U L
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1455
        with lco_tree.lock_write(), lco_tree.branch.unlock(), \
1456
                lco_tree.branch.repository.lock_write():
2363.5.11 by Aaron Bentley
All info tests pass
1457
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1458
                                            lco_tree, repo_branch=repo_branch,
1459
                                            tree_locked=True,
1460
                                            repo_locked=True,
1461
                                            verbose=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1462
        # U L U
7356.1.5 by Jelmer Vernooij
Use more ExitStacks.
1463
        with lco_tree.branch.lock_write(), lco_tree.branch.repository.unlock():
2363.5.11 by Aaron Bentley
All info tests pass
1464
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1465
                                            lco_tree, repo_branch=repo_branch,
1466
                                            branch_locked=True,
1467
                                            verbose=True)
1694.2.6 by Martin Pool
[merge] bzr.dev
1468
2425.3.2 by John Arbash Meinel
Make "test_info_locking" an expected failure on win32 for now.
1469
        if sys.platform == 'win32':
6622.1.29 by Jelmer Vernooij
Fix some more tests.
1470
            self.knownFailure('Win32 cannot run "brz info"'
2425.3.2 by John Arbash Meinel
Make "test_info_locking" an expected failure on win32 for now.
1471
                              ' when the tree is locked.')
1472
3221.21.3 by Ian Clatworthy
shallow -> stacked
1473
    def test_info_stacked(self):
3221.11.21 by Robert Collins
Have info report on stacked branches.
1474
        # We have a mainline
1475
        trunk_tree = self.make_branch_and_tree('mainline',
7143.15.2 by Jelmer Vernooij
Run autopep8.
1476
                                               format='1.6')
3221.11.21 by Robert Collins
Have info report on stacked branches.
1477
        trunk_tree.commit('mainline')
3221.21.3 by Ian Clatworthy
shallow -> stacked
1478
        # and a branch from it which is stacked
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1479
        new_dir = trunk_tree.controldir.sprout('newbranch', stacked=True)
3221.11.21 by Robert Collins
Have info report on stacked branches.
1480
        out, err = self.run_bzr('info newbranch')
1481
        self.assertEqual(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1482
            """Standalone tree (format: 1.6)
3221.11.21 by Robert Collins
Have info report on stacked branches.
1483
Location:
1484
  branch root: newbranch
1485
1486
Related branches:
1487
  parent branch: mainline
1488
     stacked on: mainline
1489
""", out)
1490
        self.assertEqual("", err)
6181.1.1 by Jelmer Vernooij
If the branch doesn't support last_revision_info, don't display
1491
1492
    def test_info_revinfo_optional(self):
1493
        tree = self.make_branch_and_tree('.')
7143.15.2 by Jelmer Vernooij
Run autopep8.
1494
6181.1.1 by Jelmer Vernooij
If the branch doesn't support last_revision_info, don't display
1495
        def last_revision_info(self):
1496
            raise errors.UnsupportedOperation(last_revision_info, self)
1497
        self.overrideAttr(
1498
            branch.Branch, "last_revision_info", last_revision_info)
1499
        out, err = self.run_bzr('info -v .')
1500
        self.assertEqual(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1501
            """Standalone tree (format: 2a)
6181.1.1 by Jelmer Vernooij
If the branch doesn't support last_revision_info, don't display
1502
Location:
1503
  branch root: .
1504
1505
Format:
1506
       control: Meta directory format 1
1507
  working tree: Working tree format 6
1508
        branch: Branch format 7
1509
    repository: Repository format 2a - rich roots, group compression and chk inventories
1510
6437.21.4 by Jelmer Vernooij
Fix info tests.
1511
Control directory:
1512
         1 branches
1513
6181.1.1 by Jelmer Vernooij
If the branch doesn't support last_revision_info, don't display
1514
In the working tree:
1515
         0 unchanged
1516
         0 modified
1517
         0 added
1518
         0 removed
1519
         0 renamed
7358.17.2 by Jelmer Vernooij
Fix some tests.
1520
         0 copied
6181.1.1 by Jelmer Vernooij
If the branch doesn't support last_revision_info, don't display
1521
         0 unknown
1522
         0 ignored
1523
         0 versioned subdirectories
1524
""", out)
7045.1.14 by Jelmer Vernooij
More fixes.
1525
        self.assertEqual("", err)
6240.1.1 by Jelmer Vernooij
Show the number of colocated branches in 'bzr info -v'.
1526
1527
    def test_info_shows_colocated_branches(self):
6653.6.1 by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir.
1528
        bzrdir = self.make_branch('.', format='development-colo').controldir
6240.1.1 by Jelmer Vernooij
Show the number of colocated branches in 'bzr info -v'.
1529
        bzrdir.create_branch(name="colo1")
1530
        bzrdir.create_branch(name="colo2")
1531
        bzrdir.create_branch(name="colo3")
1532
        out, err = self.run_bzr('info -v .')
1533
        self.assertEqualDiff(
7143.15.2 by Jelmer Vernooij
Run autopep8.
1534
            """Standalone branch (format: development-colo)
6240.1.1 by Jelmer Vernooij
Show the number of colocated branches in 'bzr info -v'.
1535
Location:
1536
  branch root: .
1537
1538
Format:
1539
       control: Meta directory format 1 with support for colocated branches
1540
        branch: Branch format 7
1541
    repository: Repository format 2a - rich roots, group compression and chk inventories
1542
1543
Control directory:
1544
         4 branches
1545
1546
Branch history:
1547
         0 revisions
1548
1549
Repository:
1550
         0 revisions
1551
""", out)
7045.1.14 by Jelmer Vernooij
More fixes.
1552
        self.assertEqual("", err)