/brz/remove-bazaar

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