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