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