/brz/remove-bazaar

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