/brz/remove-bazaar

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