~bzr-pqm/bzr/bzr.dev

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