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