~bzr-pqm/bzr/bzr.dev

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