/brz/remove-bazaar

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