~bzr-pqm/bzr/bzr.dev

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