~bzr-pqm/bzr/bzr.dev

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