/brz/remove-bazaar

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