/brz/remove-bazaar

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