/brz/remove-bazaar

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