/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
1
# Copyright (C) 2006 by Canonical Ltd
2
# -*- coding: utf-8 -*-
3
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.
8
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.
13
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
21
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
22
import bzrlib
23
24
1534.5.1 by Robert Collins
Give info some reasonable output and tests.
25
from bzrlib.osutils import format_date
26
from bzrlib.tests import TestSkipped
27
from bzrlib.tests.blackbox import ExternalBase
28
29
30
class TestInfo(ExternalBase):
31
1694.2.6 by Martin Pool
[merge] bzr.dev
32
    def test_info_non_existing(self):
33
        out, err = self.runbzr('info /i/do/not/exist/', retcode=3)
34
        self.assertEqual(out, '')
35
        self.assertEqual(err, 'bzr: ERROR: Not a branch: /i/do/not/exist/\n')
36
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
37
    def test_info_standalone(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
38
        transport = self.get_transport()
39
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
40
        # Create initial standalone branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
41
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
42
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
43
        tree1 = self.make_branch_and_tree('standalone')
44
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
45
        self.build_tree(['standalone/a'])
46
        tree1.add('a')
47
        branch1 = tree1.branch
48
        out, err = self.runbzr('info standalone')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
49
        self.assertEqualDiff(
50
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
51
  branch root: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
52
53
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
54
       control: All-in-one format 6
55
  working tree: Working tree format 2
56
        branch: Branch format 4
57
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
58
59
In the working tree:
60
         0 unchanged
61
         0 modified
62
         1 added
63
         0 removed
64
         0 renamed
65
         0 unknown
66
         0 ignored
67
         0 versioned subdirectories
68
69
Branch history:
70
         0 revisions
71
72
Revision store:
73
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
74
         0 KiB
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
75
""" % branch1.bzrdir.root_transport.base, out)
76
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
77
        tree1.commit('commit one')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
78
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
79
        datestring_first = format_date(rev.timestamp, rev.timezone)
80
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
81
        # Branch standalone with push location
82
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
83
        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
84
        out, err = self.runbzr('info branch --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
85
        self.assertEqualDiff(
86
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
87
  branch root: %s
88
89
Related branches:
90
      parent branch: %s
91
  publish to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
92
93
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
94
       control: All-in-one format 6
95
  working tree: Working tree format 2
96
        branch: Branch format 4
97
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
98
99
In the working tree:
100
         1 unchanged
101
         0 modified
102
         0 added
103
         0 removed
104
         0 renamed
105
         0 unknown
106
         0 ignored
107
         0 versioned subdirectories
108
109
Branch history:
110
         1 revision
111
         1 committer
112
         0 days old
113
   first revision: %s
114
  latest revision: %s
115
116
Revision store:
117
         1 revision
1694.2.6 by Martin Pool
[merge] bzr.dev
118
         %d KiB
119
""" % (branch2.bzrdir.root_transport.base,
120
       branch1.bzrdir.root_transport.base,
121
       branch1.bzrdir.root_transport.base,
122
       datestring_first, datestring_first,
123
       # poking at _revision_store isn't all that clean, but neither is
124
       # having the ui test dependent on the exact overhead of a given store.
125
       branch2.repository._revision_store.total_size(
126
        branch2.repository.get_transaction())[1] / 1024,
127
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
128
        self.assertEqual('', err)
129
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
130
        # Branch and bind to standalone, needs upgrade to metadir
131
        # (creates backup as unknown)
1624.3.47 by Olaf Conradi
Fix test case for bzr info in upgrading a standalone branch to metadir,
132
        branch1.bzrdir.sprout('bound')
133
        bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
134
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
135
        branch3.bind(branch1)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
136
        out, err = self.runbzr('info bound')
137
        self.assertEqualDiff(
138
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
139
       checkout root: %s
140
  checkout of branch: %s
141
142
Related branches:
143
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
144
145
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
146
       control: Meta directory format 1
147
  working tree: Working tree format 3
148
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
149
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
150
151
In the working tree:
152
         1 unchanged
153
         0 modified
154
         0 added
155
         0 removed
156
         0 renamed
157
         1 unknown
158
         0 ignored
159
         0 versioned subdirectories
160
161
Branch history:
162
         1 revision
163
         0 days old
164
   first revision: %s
165
  latest revision: %s
166
167
Revision store:
168
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
169
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
170
""" % (branch3.bzrdir.root_transport.base,
171
       branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
172
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
173
       branch3.repository._format.get_format_description(),
174
       datestring_first, datestring_first,
175
       # poking at _revision_store isn't all that clean, but neither is
176
       # having the ui test dependent on the exact overhead of a given store.
177
       branch3.repository._revision_store.total_size(
178
        branch3.repository.get_transaction())[1] / 1024,
179
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
180
        self.assertEqual('', err)
181
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
182
        # Checkout standalone (same as above, but does not have parent set)
183
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
184
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
185
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
186
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
187
        branch4.bind(branch1)
188
        branch4.bzrdir.open_workingtree().update()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
189
        out, err = self.runbzr('info checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
190
        self.assertEqualDiff(
191
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
192
       checkout root: %s
193
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
194
195
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
196
       control: Meta directory format 1
197
  working tree: Working tree format 3
198
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
199
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
200
201
In the working tree:
202
         1 unchanged
203
         0 modified
204
         0 added
205
         0 removed
206
         0 renamed
207
         0 unknown
208
         0 ignored
209
         0 versioned subdirectories
210
211
Branch history:
212
         1 revision
213
         1 committer
214
         0 days old
215
   first revision: %s
216
  latest revision: %s
217
218
Revision store:
219
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
220
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
221
""" % (branch4.bzrdir.root_transport.base,
222
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
223
       branch4.repository._format.get_format_description(),
224
       datestring_first, datestring_first,
225
       # poking at _revision_store isn't all that clean, but neither is
226
       # having the ui test dependent on the exact overhead of a given store.
227
       branch4.repository._revision_store.total_size(
228
        branch4.repository.get_transaction())[1] / 1024,
229
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
230
        self.assertEqual('', err)
231
232
        # Lightweight checkout (same as above, different branch and repository)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
233
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
234
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
235
        transport.mkdir('lightcheckout')
236
        dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
237
        bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
238
        dir5.create_workingtree()
239
        tree5 = dir5.open_workingtree()
240
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
241
        branch5 = tree5.branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
242
        out, err = self.runbzr('info lightcheckout')
243
        self.assertEqualDiff(
244
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
245
  light checkout root: %s
246
   checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
247
248
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
249
       control: Meta directory format 1
250
  working tree: Working tree format 3
251
        branch: Branch format 4
252
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
253
254
In the working tree:
255
         1 unchanged
256
         0 modified
257
         0 added
258
         0 removed
259
         0 renamed
260
         0 unknown
261
         0 ignored
262
         0 versioned subdirectories
263
264
Branch history:
265
         1 revision
266
         0 days old
267
   first revision: %s
268
  latest revision: %s
269
270
Revision store:
271
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
272
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
273
""" % (tree5.bzrdir.root_transport.base,
274
       branch1.bzrdir.root_transport.base,
275
       datestring_first, datestring_first,
276
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
277
        self.assertEqual('', err)
278
279
        # Update initial standalone branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
280
        self.build_tree(['standalone/b'])
281
        tree1.add('b')
282
        tree1.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
283
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
284
        datestring_last = format_date(rev.timestamp, rev.timezone)
285
286
        # Out of date branched standalone branch will not be detected
287
        out, err = self.runbzr('info branch')
288
        self.assertEqualDiff(
289
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
290
  branch root: %s
291
292
Related branches:
293
      parent branch: %s
294
  publish to branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
295
296
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
297
       control: All-in-one format 6
298
  working tree: Working tree format 2
299
        branch: Branch format 4
300
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
301
302
In the working tree:
303
         1 unchanged
304
         0 modified
305
         0 added
306
         0 removed
307
         0 renamed
308
         0 unknown
309
         0 ignored
310
         0 versioned subdirectories
311
312
Branch history:
313
         1 revision
314
         0 days old
315
   first revision: %s
316
  latest revision: %s
317
318
Revision store:
319
         1 revision
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
320
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
321
""" % (branch2.bzrdir.root_transport.base,
322
       branch1.bzrdir.root_transport.base,
323
       branch1.bzrdir.root_transport.base,
324
       datestring_first, datestring_first,
325
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
326
        self.assertEqual('', err)
327
328
        # Out of date bound branch
329
        out, err = self.runbzr('info bound')
330
        self.assertEqualDiff(
331
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
332
       checkout root: %s
333
  checkout of branch: %s
334
335
Related branches:
336
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
337
338
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
339
       control: Meta directory format 1
340
  working tree: Working tree format 3
341
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
342
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
343
344
Branch is out of date: missing 1 revision.
345
346
In the working tree:
347
         1 unchanged
348
         0 modified
349
         0 added
350
         0 removed
351
         0 renamed
352
         1 unknown
353
         0 ignored
354
         0 versioned subdirectories
355
356
Branch history:
357
         1 revision
358
         0 days old
359
   first revision: %s
360
  latest revision: %s
361
362
Revision store:
363
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
364
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
365
""" % (branch3.bzrdir.root_transport.base,
366
       branch1.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
367
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
368
       branch3.repository._format.get_format_description(),
369
       datestring_first, datestring_first,
370
       # poking at _revision_store isn't all that clean, but neither is
371
       # having the ui test dependent on the exact overhead of a given store.
372
       branch3.repository._revision_store.total_size(
373
        branch3.repository.get_transaction())[1] / 1024,
374
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
375
        self.assertEqual('', err)
376
377
        # Out of date checkout
378
        out, err = self.runbzr('info checkout')
379
        self.assertEqualDiff(
380
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
381
       checkout root: %s
382
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
383
384
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
385
       control: Meta directory format 1
386
  working tree: Working tree format 3
387
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
388
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
389
390
Branch is out of date: missing 1 revision.
391
392
In the working tree:
393
         1 unchanged
394
         0 modified
395
         0 added
396
         0 removed
397
         0 renamed
398
         0 unknown
399
         0 ignored
400
         0 versioned subdirectories
401
402
Branch history:
403
         1 revision
404
         0 days old
405
   first revision: %s
406
  latest revision: %s
407
408
Revision store:
409
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
410
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
411
""" % (branch4.bzrdir.root_transport.base,
412
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
413
       branch4.repository._format.get_format_description(),
414
       datestring_first, datestring_first,
415
       # poking at _revision_store isn't all that clean, but neither is
416
       # having the ui test dependent on the exact overhead of a given store.
417
       branch4.repository._revision_store.total_size(
418
        branch4.repository.get_transaction())[1] / 1024,
419
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
420
        self.assertEqual('', err)
421
422
        # Out of date lightweight checkout
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
423
        out, err = self.runbzr('info lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
424
        self.assertEqualDiff(
425
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
426
  light checkout root: %s
427
   checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
428
429
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
430
       control: Meta directory format 1
431
  working tree: Working tree format 3
432
        branch: Branch format 4
433
    repository: Weave repository format 6
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
434
435
Working tree is out of date: missing 1 revision.
436
437
In the working tree:
438
         1 unchanged
439
         0 modified
440
         0 added
441
         0 removed
442
         0 renamed
443
         0 unknown
444
         0 ignored
445
         0 versioned subdirectories
446
447
Branch history:
448
         2 revisions
449
         1 committer
450
         0 days old
451
   first revision: %s
452
  latest revision: %s
453
454
Revision store:
455
         2 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
456
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
457
""" % (tree5.bzrdir.root_transport.base,
458
       branch1.bzrdir.root_transport.base,
459
       datestring_first, datestring_last,
460
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
461
        self.assertEqual('', err)
462
1624.3.48 by Olaf Conradi
Add info on standalone branches without a working tree.
463
    def test_info_standalone_no_tree(self):
464
        # create standalone branch without a working tree
465
        branch = self.make_branch('branch')
466
        repo = branch.repository
467
        out, err = self.runbzr('info branch')
468
        self.assertEqualDiff(
469
"""Location:
470
  branch root: %s
471
472
Format:
473
       control: Meta directory format 1
474
        branch: Branch format 5
475
    repository: %s
476
477
Branch history:
478
         0 revisions
479
480
Revision store:
481
         0 revisions
482
         0 KiB
483
""" % (branch.bzrdir.root_transport.base,
484
       repo._format.get_format_description(),
485
       ), out)
486
        self.assertEqual('', err)
487
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
488
    def test_info_shared_repository(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
489
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
490
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
491
        transport = self.get_transport()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
492
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
493
        # Create shared repository
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
494
        repo = self.make_repository('repo', shared=True)
495
        repo.set_make_working_trees(False)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
496
        out, err = self.runbzr('info repo')
497
        self.assertEqualDiff(
498
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
499
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
500
501
Format:
502
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
503
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
504
505
Revision store:
506
         0 revisions
507
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
508
""" % (repo.bzrdir.root_transport.base,
509
       repo._format.get_format_description(),
510
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
511
        self.assertEqual('', err)
512
513
        # Create branch inside shared repository
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
514
        repo.bzrdir.root_transport.mkdir('branch')
515
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
516
        out, err = self.runbzr('info repo/branch')
517
        self.assertEqualDiff(
518
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
519
  shared repository: %s
520
  repository branch: branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
521
522
Format:
523
       control: Meta directory format 1
524
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
525
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
526
527
Branch history:
528
         0 revisions
529
530
Revision store:
531
         0 revisions
532
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
533
""" % (repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
534
       repo._format.get_format_description(),
535
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
536
        self.assertEqual('', err)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
537
538
        # Create lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
539
        transport.mkdir('tree')
540
        transport.mkdir('tree/lightcheckout')
541
        dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
542
        bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
543
        dir2.create_workingtree()
544
        tree2 = dir2.open_workingtree()
545
        branch2 = tree2.branch
546
        out, err = self.runbzr('info tree/lightcheckout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
547
        self.assertEqualDiff(
548
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
549
  light checkout root: %s
550
    shared repository: %s
551
    repository branch: branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
552
553
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
554
       control: Meta directory format 1
555
  working tree: Working tree format 3
556
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
557
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
558
559
In the working tree:
560
         0 unchanged
561
         0 modified
562
         0 added
563
         0 removed
564
         0 renamed
565
         0 unknown
566
         0 ignored
567
         0 versioned subdirectories
568
569
Branch history:
570
         0 revisions
571
572
Revision store:
573
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
574
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
575
""" % (tree2.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
576
       repo.bzrdir.root_transport.base,
577
       repo._format.get_format_description(),
578
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
579
        self.assertEqual('', err)
580
581
        # Create normal checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
582
        branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
583
        branch3.bind(branch1)
584
        tree3 = branch3.bzrdir.open_workingtree()
585
        tree3.update()
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
586
        out, err = self.runbzr('info tree/checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
587
        self.assertEqualDiff(
588
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
589
       checkout root: %s
590
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
591
592
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
593
       control: Meta directory format 1
594
  working tree: Working tree format 3
595
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
596
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
597
598
In the working tree:
599
         0 unchanged
600
         0 modified
601
         0 added
602
         0 removed
603
         0 renamed
604
         0 unknown
605
         0 ignored
606
         0 versioned subdirectories
607
608
Branch history:
609
         0 revisions
610
         0 committers
611
612
Revision store:
613
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
614
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
615
""" % (branch3.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
616
       branch1.bzrdir.root_transport.base,
617
       repo._format.get_format_description(),
618
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
619
        self.assertEqual('', err)
620
621
        # Update lightweight checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
622
        self.build_tree(['tree/lightcheckout/a'])
623
        tree2.add('a')
624
        tree2.commit('commit one')
625
        rev = repo.get_revision(branch2.revision_history()[0])
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
626
        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
627
        out, err = self.runbzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
628
        self.assertEqualDiff(
629
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
630
  light checkout root: %s
631
    shared repository: %s
632
    repository branch: branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
633
634
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
635
       control: Meta directory format 1
636
  working tree: Working tree format 3
637
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
638
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
639
640
In the working tree:
641
         1 unchanged
642
         0 modified
643
         0 added
644
         0 removed
645
         0 renamed
646
         0 unknown
647
         0 ignored
648
         0 versioned subdirectories
649
650
Branch history:
651
         1 revision
652
         1 committer
653
         0 days old
654
   first revision: %s
655
  latest revision: %s
656
657
Revision store:
658
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
659
         %d KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
660
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
661
       repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
662
       repo._format.get_format_description(),
663
       datestring_first, datestring_first,
664
       # poking at _revision_store isn't all that clean, but neither is
665
       # having the ui test dependent on the exact overhead of a given store.
666
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
667
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
668
        self.assertEqual('', err)
669
670
        # Out of date checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
671
        out, err = self.runbzr('info tree/checkout')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
672
        self.assertEqualDiff(
673
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
674
       checkout root: %s
675
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
676
677
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
678
       control: Meta directory format 1
679
  working tree: Working tree format 3
680
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
681
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
682
683
Branch is out of date: missing 1 revision.
684
685
In the working tree:
686
         0 unchanged
687
         0 modified
688
         0 added
689
         0 removed
690
         0 renamed
691
         0 unknown
692
         0 ignored
693
         0 versioned subdirectories
694
695
Branch history:
696
         0 revisions
697
698
Revision store:
699
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
700
         0 KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
701
""" % (tree3.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
702
       branch1.bzrdir.root_transport.base,
703
       repo._format.get_format_description(),
704
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
705
        self.assertEqual('', err)
706
707
        # Update checkout
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
708
        tree3.update()
709
        self.build_tree(['tree/checkout/b'])
710
        tree3.add('b')
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
711
        out, err = self.runbzr('info tree/checkout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
712
        self.assertEqualDiff(
713
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
714
       checkout root: %s
715
  checkout of branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
716
717
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
718
       control: Meta directory format 1
719
  working tree: Working tree format 3
720
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
721
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
722
723
In the working tree:
724
         1 unchanged
725
         0 modified
726
         1 added
727
         0 removed
728
         0 renamed
729
         0 unknown
730
         0 ignored
731
         0 versioned subdirectories
732
733
Branch history:
734
         1 revision
735
         1 committer
736
         0 days old
737
   first revision: %s
738
  latest revision: %s
739
740
Revision store:
741
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
742
         %d KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
743
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
744
       repo._format.get_format_description(),
745
       datestring_first, datestring_first,
746
       # poking at _revision_store isn't all that clean, but neither is
747
       # having the ui test dependent on the exact overhead of a given store.
748
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
749
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
750
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
751
        tree3.commit('commit two')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
752
753
        # Out of date lightweight checkout
1624.3.12 by Olaf Conradi
Fixed bug in test case where datestring_last returned the first.
754
        rev = repo.get_revision(branch1.revision_history()[-1])
755
        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
756
        out, err = self.runbzr('info tree/lightcheckout --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
757
        self.assertEqualDiff(
758
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
759
  light checkout root: %s
760
    shared repository: %s
761
    repository branch: branch
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
762
763
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
764
       control: Meta directory format 1
765
  working tree: Working tree format 3
766
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
767
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
768
769
Working tree is out of date: missing 1 revision.
770
771
In the working tree:
772
         1 unchanged
773
         0 modified
774
         0 added
775
         0 removed
776
         0 renamed
777
         0 unknown
778
         0 ignored
779
         0 versioned subdirectories
780
781
Branch history:
782
         2 revisions
783
         1 committer
784
         0 days old
785
   first revision: %s
786
  latest revision: %s
787
788
Revision store:
789
         2 revisions
1666.1.6 by Robert Collins
Make knit the default format.
790
         %d KiB
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
791
""" % (tree2.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
792
       repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
793
       repo._format.get_format_description(),
794
       datestring_first, datestring_last,
795
       # poking at _revision_store isn't all that clean, but neither is
796
       # having the ui test dependent on the exact overhead of a given store.
797
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
798
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
799
        self.assertEqual('', err)
800
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
801
        # Show info about shared branch
802
        out, err = self.runbzr('info repo/branch --verbose')
803
        self.assertEqualDiff(
804
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
805
  shared repository: %s
806
  repository branch: branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
807
808
Format:
809
       control: Meta directory format 1
810
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
811
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
812
813
Branch history:
814
         2 revisions
815
         1 committer
816
         0 days old
817
   first revision: %s
818
  latest revision: %s
819
820
Revision store:
821
         2 revisions
1666.1.6 by Robert Collins
Make knit the default format.
822
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
823
""" % (repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
824
       repo._format.get_format_description(),
825
       datestring_first, datestring_last,
826
       # poking at _revision_store isn't all that clean, but neither is
827
       # having the ui test dependent on the exact overhead of a given store.
828
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
829
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
830
        self.assertEqual('', err)
831
832
        # Show info about repository with revisions
833
        out, err = self.runbzr('info repo')
834
        self.assertEqualDiff(
835
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
836
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
837
838
Format:
839
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
840
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
841
842
Revision store:
843
         2 revisions
1666.1.6 by Robert Collins
Make knit the default format.
844
         %d KiB
845
""" % (repo.bzrdir.root_transport.base,
846
       repo._format.get_format_description(),
847
       # poking at _revision_store isn't all that clean, but neither is
848
       # having the ui test dependent on the exact overhead of a given store.
849
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1694.2.6 by Martin Pool
[merge] bzr.dev
850
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
851
        self.assertEqual('', err)
852
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
853
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
854
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
855
    def test_info_shared_repository_with_trees(self):
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
856
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
857
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
858
        transport = self.get_transport()
859
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
860
        # Create shared repository with working trees
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
861
        repo = self.make_repository('repo', shared=True)
862
        repo.set_make_working_trees(True)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
863
        out, err = self.runbzr('info repo')
864
        self.assertEqualDiff(
865
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
866
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
867
868
Format:
869
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
870
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
871
872
Create working tree for new branches inside the repository.
873
874
Revision store:
875
         0 revisions
876
         0 KiB
1666.1.6 by Robert Collins
Make knit the default format.
877
""" % (repo.bzrdir.root_transport.base,
878
       repo._format.get_format_description(),
879
       ), out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
880
        self.assertEqual('', err)
881
882
        # Create two branches
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
883
        repo.bzrdir.root_transport.mkdir('branch1')
884
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
885
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
886
887
        # Empty first branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
888
        out, err = self.runbzr('info repo/branch1 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
889
        self.assertEqualDiff(
890
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
891
    shared repository: %s
892
  repository checkout: branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
893
894
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
895
       control: Meta directory format 1
896
  working tree: Working tree format 3
897
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
898
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
899
900
In the working tree:
901
         0 unchanged
902
         0 modified
903
         0 added
904
         0 removed
905
         0 renamed
906
         0 unknown
907
         0 ignored
908
         0 versioned subdirectories
909
910
Branch history:
911
         0 revisions
912
         0 committers
913
914
Revision store:
915
         0 revisions
1624.3.14 by Olaf Conradi
Move to using kibi for binary prefix as per standard IEEE 1541.
916
         0 KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
917
""" % (repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
918
       repo._format.get_format_description(),
919
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
920
        self.assertEqual('', err)
921
922
        # Update first branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
923
        self.build_tree(['repo/branch1/a'])
924
        tree1 = branch1.bzrdir.open_workingtree()
925
        tree1.add('a')
926
        tree1.commit('commit one')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
927
        rev = repo.get_revision(branch1.revision_history()[0])
928
        datestring_first = format_date(rev.timestamp, rev.timezone)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
929
        out, err = self.runbzr('info repo/branch1')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
930
        self.assertEqualDiff(
931
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
932
    shared repository: %s
933
  repository checkout: branch1
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
934
935
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
936
       control: Meta directory format 1
937
  working tree: Working tree format 3
938
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
939
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
940
941
In the working tree:
942
         1 unchanged
943
         0 modified
944
         0 added
945
         0 removed
946
         0 renamed
947
         0 unknown
948
         0 ignored
949
         0 versioned subdirectories
950
951
Branch history:
952
         1 revision
953
         0 days old
954
   first revision: %s
955
  latest revision: %s
956
957
Revision store:
958
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
959
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
960
""" % (repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
961
       repo._format.get_format_description(),
962
       datestring_first, datestring_first,
963
       # poking at _revision_store isn't all that clean, but neither is
964
       # having the ui test dependent on the exact overhead of a given store.
965
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
966
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
967
        self.assertEqual('', err)
968
969
        # Out of date second branch
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
970
        out, err = self.runbzr('info repo/branch2 --verbose')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
971
        self.assertEqualDiff(
972
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
973
    shared repository: %s
974
  repository checkout: branch2
975
976
Related branches:
977
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
978
979
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
980
       control: Meta directory format 1
981
  working tree: Working tree format 3
982
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
983
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
984
985
In the working tree:
986
         0 unchanged
987
         0 modified
988
         0 added
989
         0 removed
990
         0 renamed
991
         0 unknown
992
         0 ignored
993
         0 versioned subdirectories
994
995
Branch history:
996
         0 revisions
997
         0 committers
998
999
Revision store:
1000
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
1001
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
1002
""" % (repo.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
1003
       branch1.bzrdir.root_transport.base,
1004
       repo._format.get_format_description(),
1005
       # poking at _revision_store isn't all that clean, but neither is
1006
       # having the ui test dependent on the exact overhead of a given store.
1007
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1008
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1009
        self.assertEqual('', err)
1010
1011
        # Update second branch
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
1012
        tree2 = branch2.bzrdir.open_workingtree()
1013
        tree2.pull(branch1)
1014
        out, err = self.runbzr('info repo/branch2')
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1015
        self.assertEqualDiff(
1016
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
1017
    shared repository: %s
1018
  repository checkout: branch2
1019
1020
Related branches:
1021
  parent branch: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1022
1023
Format:
1624.3.19 by Olaf Conradi
New call get_format_description to give a user-friendly description of a
1024
       control: Meta directory format 1
1025
  working tree: Working tree format 3
1026
        branch: Branch format 5
1666.1.6 by Robert Collins
Make knit the default format.
1027
    repository: %s
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1028
1029
In the working tree:
1030
         1 unchanged
1031
         0 modified
1032
         0 added
1033
         0 removed
1034
         0 renamed
1035
         0 unknown
1036
         0 ignored
1037
         0 versioned subdirectories
1038
1039
Branch history:
1040
         1 revision
1041
         0 days old
1042
   first revision: %s
1043
  latest revision: %s
1044
1045
Revision store:
1046
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
1047
         %d KiB
1694.2.6 by Martin Pool
[merge] bzr.dev
1048
""" % (repo.bzrdir.root_transport.base,
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1049
       branch1.bzrdir.root_transport.base,
1666.1.6 by Robert Collins
Make knit the default format.
1050
       repo._format.get_format_description(),
1051
       datestring_first, datestring_first,
1052
       # poking at _revision_store isn't all that clean, but neither is
1053
       # having the ui test dependent on the exact overhead of a given store.
1054
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1055
       ), out)
1624.3.10 by Olaf Conradi
Add blackbox test case for command bzr info.
1056
        self.assertEqual('', err)
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
1057
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1058
        # Show info about repository with revisions
1059
        out, err = self.runbzr('info repo')
1060
        self.assertEqualDiff(
1061
"""Location:
1694.2.6 by Martin Pool
[merge] bzr.dev
1062
  shared repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1063
1064
Format:
1065
       control: Meta directory format 1
1666.1.6 by Robert Collins
Make knit the default format.
1066
    repository: %s
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1067
1068
Create working tree for new branches inside the repository.
1069
1070
Revision store:
1071
         1 revision
1666.1.6 by Robert Collins
Make knit the default format.
1072
         %d KiB
1073
""" % (repo.bzrdir.root_transport.base,
1074
       repo._format.get_format_description(),
1075
       # poking at _revision_store isn't all that clean, but neither is
1076
       # having the ui test dependent on the exact overhead of a given store.
1077
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1078
       ),
1079
       out)
1624.3.21 by Olaf Conradi
Make bzr info command work on both local and remote locations. Support
1080
        self.assertEqual('', err)
1081
1624.3.18 by Olaf Conradi
Move to using bzrlib API for blackbox test cases.
1082
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1694.2.6 by Martin Pool
[merge] bzr.dev
1083
    
1084
    def test_info_shared_repository_with_tree_in_root(self):
1085
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
1086
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1087
        transport = self.get_transport()
1088
1089
        # Create shared repository with working trees
1090
        repo = self.make_repository('repo', shared=True)
1091
        repo.set_make_working_trees(True)
1092
        out, err = self.runbzr('info repo')
1093
        self.assertEqualDiff(
1094
"""Location:
1095
  shared repository: %s
1096
1097
Format:
1098
       control: Meta directory format 1
1099
    repository: %s
1100
1101
Create working tree for new branches inside the repository.
1102
1103
Revision store:
1104
         0 revisions
1105
         0 KiB
1106
""" % (repo.bzrdir.root_transport.base,
1107
       repo._format.get_format_description(),
1108
       ), out)
1109
        self.assertEqual('', err)
1110
1111
        # Create branch in root of repository
1112
        control = repo.bzrdir
1113
        branch = control.create_branch()
1114
        control.create_workingtree()
1115
        out, err = self.runbzr('info repo')
1116
        self.assertEqualDiff(
1117
"""Location:
1118
    shared repository: %s
1119
  repository checkout: .
1120
1121
Format:
1122
       control: Meta directory format 1
1123
  working tree: Working tree format 3
1124
        branch: Branch format 5
1125
    repository: %s
1126
1127
In the working tree:
1128
         0 unchanged
1129
         0 modified
1130
         0 added
1131
         0 removed
1132
         0 renamed
1133
         0 unknown
1134
         0 ignored
1135
         0 versioned subdirectories
1136
1137
Branch history:
1138
         0 revisions
1139
1140
Revision store:
1141
         0 revisions
1142
         0 KiB
1143
""" % (repo.bzrdir.root_transport.base,
1144
       repo._format.get_format_description(),
1145
       ), out)
1146
        self.assertEqual('', err)
1147
1148
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1149
1150
    def test_info_locking(self):
1151
        transport = self.get_transport()
1152
        # Create shared repository with a branch
1153
        repo = self.make_repository('repo', shared=True,
1154
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1155
        repo.set_make_working_trees(False)
1156
        repo.bzrdir.root_transport.mkdir('branch')
1157
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1158
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1159
        # Do a heavy checkout
1160
        transport.mkdir('tree')
1161
        transport.mkdir('tree/checkout')
1162
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1163
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1164
        co_branch.bind(repo_branch)
1165
        # Do a light checkout of the heavy one
1166
        transport.mkdir('tree/lightcheckout')
1167
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1168
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1169
        lco_dir.create_workingtree()
1170
        lco_tree = lco_dir.open_workingtree()
1171
1172
        # Test all permutations of locking the working tree, branch and repository
1173
        # W B R
1174
1175
        # U U U
1176
        out, err = self.runbzr('info tree/lightcheckout')
1177
        self.assertEqualDiff(
1178
"""Location:
1179
  light checkout root: %s
1180
   checkout of branch: %s
1181
1182
Format:
1183
       control: Meta directory format 1
1184
  working tree: Working tree format 3
1185
        branch: Branch format 5
1186
    repository: %s
1187
1188
In the working tree:
1189
         0 unchanged
1190
         0 modified
1191
         0 added
1192
         0 removed
1193
         0 renamed
1194
         0 unknown
1195
         0 ignored
1196
         0 versioned subdirectories
1197
1198
Branch history:
1199
         0 revisions
1200
1201
Revision store:
1202
         0 revisions
1203
         0 KiB
1204
""" % (lco_tree.bzrdir.root_transport.base,
1205
       lco_tree.branch.bzrdir.root_transport.base,
1206
       lco_tree.branch.repository._format.get_format_description(),
1207
       ), out)
1208
        self.assertEqual('', err)
1209
        # U U L
1210
        lco_tree.branch.repository.lock_write()
1211
        out, err = self.runbzr('info tree/lightcheckout')
1212
        self.assertEqualDiff(
1213
"""Location:
1214
  light checkout root: %s
1215
   checkout of branch: %s
1216
1217
Format:
1218
       control: Meta directory format 1
1219
  working tree: Working tree format 3
1220
        branch: Branch format 5
1221
    repository: %s
1222
1223
Lock status:
1224
  working tree: unlocked
1225
        branch: unlocked
1226
    repository: locked
1227
1228
In the working tree:
1229
         0 unchanged
1230
         0 modified
1231
         0 added
1232
         0 removed
1233
         0 renamed
1234
         0 unknown
1235
         0 ignored
1236
         0 versioned subdirectories
1237
1238
Branch history:
1239
         0 revisions
1240
1241
Revision store:
1242
         0 revisions
1243
         0 KiB
1244
""" % (lco_tree.bzrdir.root_transport.base,
1245
       lco_tree.branch.bzrdir.root_transport.base,
1246
       lco_tree.branch.repository._format.get_format_description(),
1247
       ), out)
1248
        self.assertEqual('', err)
1249
        lco_tree.branch.repository.unlock()
1250
        # U L L
1251
        lco_tree.branch.lock_write()
1252
        out, err = self.runbzr('info tree/lightcheckout')
1253
        self.assertEqualDiff(
1254
"""Location:
1255
  light checkout root: %s
1256
   checkout of branch: %s
1257
1258
Format:
1259
       control: Meta directory format 1
1260
  working tree: Working tree format 3
1261
        branch: Branch format 5
1262
    repository: %s
1263
1264
Lock status:
1265
  working tree: unlocked
1266
        branch: locked
1267
    repository: locked
1268
1269
In the working tree:
1270
         0 unchanged
1271
         0 modified
1272
         0 added
1273
         0 removed
1274
         0 renamed
1275
         0 unknown
1276
         0 ignored
1277
         0 versioned subdirectories
1278
1279
Branch history:
1280
         0 revisions
1281
1282
Revision store:
1283
         0 revisions
1284
         0 KiB
1285
""" % (lco_tree.bzrdir.root_transport.base,
1286
       lco_tree.branch.bzrdir.root_transport.base,
1287
       lco_tree.branch.repository._format.get_format_description(),
1288
       ), out)
1289
        self.assertEqual('', err)
1290
        lco_tree.branch.unlock()
1291
        # L L L
1292
        lco_tree.lock_write()
1293
        out, err = self.runbzr('info tree/lightcheckout')
1294
        self.assertEqualDiff(
1295
"""Location:
1296
  light checkout root: %s
1297
   checkout of branch: %s
1298
1299
Format:
1300
       control: Meta directory format 1
1301
  working tree: Working tree format 3
1302
        branch: Branch format 5
1303
    repository: %s
1304
1305
Lock status:
1306
  working tree: locked
1307
        branch: locked
1308
    repository: locked
1309
1310
In the working tree:
1311
         0 unchanged
1312
         0 modified
1313
         0 added
1314
         0 removed
1315
         0 renamed
1316
         0 unknown
1317
         0 ignored
1318
         0 versioned subdirectories
1319
1320
Branch history:
1321
         0 revisions
1322
1323
Revision store:
1324
         0 revisions
1325
         0 KiB
1326
""" % (lco_tree.bzrdir.root_transport.base,
1327
       lco_tree.branch.bzrdir.root_transport.base,
1328
       lco_tree.branch.repository._format.get_format_description(),
1329
       ), out)
1330
        self.assertEqual('', err)
1331
        lco_tree.unlock()
1332
        # L L U
1333
        lco_tree.lock_write()
1334
        lco_tree.branch.repository.unlock()
1335
        out, err = self.runbzr('info tree/lightcheckout')
1336
        self.assertEqualDiff(
1337
"""Location:
1338
  light checkout root: %s
1339
   checkout of branch: %s
1340
1341
Format:
1342
       control: Meta directory format 1
1343
  working tree: Working tree format 3
1344
        branch: Branch format 5
1345
    repository: %s
1346
1347
Lock status:
1348
  working tree: locked
1349
        branch: locked
1350
    repository: unlocked
1351
1352
In the working tree:
1353
         0 unchanged
1354
         0 modified
1355
         0 added
1356
         0 removed
1357
         0 renamed
1358
         0 unknown
1359
         0 ignored
1360
         0 versioned subdirectories
1361
1362
Branch history:
1363
         0 revisions
1364
1365
Revision store:
1366
         0 revisions
1367
         0 KiB
1368
""" % (lco_tree.bzrdir.root_transport.base,
1369
       lco_tree.branch.bzrdir.root_transport.base,
1370
       lco_tree.branch.repository._format.get_format_description(),
1371
       ), out)
1372
        self.assertEqual('', err)
1373
        lco_tree.branch.repository.lock_write()
1374
        lco_tree.unlock()
1375
        # L U U
1376
        lco_tree.lock_write()
1377
        lco_tree.branch.unlock()
1378
        out, err = self.runbzr('info tree/lightcheckout')
1379
        self.assertEqualDiff(
1380
"""Location:
1381
  light checkout root: %s
1382
   checkout of branch: %s
1383
1384
Format:
1385
       control: Meta directory format 1
1386
  working tree: Working tree format 3
1387
        branch: Branch format 5
1388
    repository: %s
1389
1390
Lock status:
1391
  working tree: locked
1392
        branch: unlocked
1393
    repository: unlocked
1394
1395
In the working tree:
1396
         0 unchanged
1397
         0 modified
1398
         0 added
1399
         0 removed
1400
         0 renamed
1401
         0 unknown
1402
         0 ignored
1403
         0 versioned subdirectories
1404
1405
Branch history:
1406
         0 revisions
1407
1408
Revision store:
1409
         0 revisions
1410
         0 KiB
1411
""" % (lco_tree.bzrdir.root_transport.base,
1412
       lco_tree.branch.bzrdir.root_transport.base,
1413
       lco_tree.branch.repository._format.get_format_description(),
1414
       ), out)
1415
        self.assertEqual('', err)
1416
        lco_tree.branch.lock_write()
1417
        lco_tree.unlock()
1418
        # L U L
1419
        lco_tree.lock_write()
1420
        lco_tree.branch.unlock()
1421
        lco_tree.branch.repository.lock_write()
1422
        out, err = self.runbzr('info tree/lightcheckout')
1423
        self.assertEqualDiff(
1424
"""Location:
1425
  light checkout root: %s
1426
   checkout of branch: %s
1427
1428
Format:
1429
       control: Meta directory format 1
1430
  working tree: Working tree format 3
1431
        branch: Branch format 5
1432
    repository: %s
1433
1434
Lock status:
1435
  working tree: locked
1436
        branch: unlocked
1437
    repository: locked
1438
1439
In the working tree:
1440
         0 unchanged
1441
         0 modified
1442
         0 added
1443
         0 removed
1444
         0 renamed
1445
         0 unknown
1446
         0 ignored
1447
         0 versioned subdirectories
1448
1449
Branch history:
1450
         0 revisions
1451
1452
Revision store:
1453
         0 revisions
1454
         0 KiB
1455
""" % (lco_tree.bzrdir.root_transport.base,
1456
       lco_tree.branch.bzrdir.root_transport.base,
1457
       lco_tree.branch.repository._format.get_format_description(),
1458
       ), out)
1459
        self.assertEqual('', err)
1460
        lco_tree.branch.repository.unlock()
1461
        lco_tree.branch.lock_write()
1462
        lco_tree.unlock()
1463
        # U L U
1464
        lco_tree.branch.lock_write()
1465
        lco_tree.branch.repository.unlock()
1466
        out, err = self.runbzr('info tree/lightcheckout')
1467
        self.assertEqualDiff(
1468
"""Location:
1469
  light checkout root: %s
1470
   checkout of branch: %s
1471
1472
Format:
1473
       control: Meta directory format 1
1474
  working tree: Working tree format 3
1475
        branch: Branch format 5
1476
    repository: %s
1477
1478
Lock status:
1479
  working tree: unlocked
1480
        branch: locked
1481
    repository: unlocked
1482
1483
In the working tree:
1484
         0 unchanged
1485
         0 modified
1486
         0 added
1487
         0 removed
1488
         0 renamed
1489
         0 unknown
1490
         0 ignored
1491
         0 versioned subdirectories
1492
1493
Branch history:
1494
         0 revisions
1495
1496
Revision store:
1497
         0 revisions
1498
         0 KiB
1499
""" % (lco_tree.bzrdir.root_transport.base,
1500
       lco_tree.branch.bzrdir.root_transport.base,
1501
       lco_tree.branch.repository._format.get_format_description(),
1502
       ), out)
1503
        self.assertEqual('', err)
1504
        lco_tree.branch.repository.lock_write()
1505
        lco_tree.branch.unlock()
1506
1507
    def test_info_locking_oslocks(self):
1508
        tree = self.make_branch_and_tree('branch',
1509
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1510
1511
        # Test all permutations of locking the working tree, branch and repository
1512
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1513
        # implemented by raising NotImplementedError and get_physical_lock_status()
1514
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
1515
        # W B R
1516
1517
        # U U U
1518
        out, err = self.runbzr('info branch')
1519
        self.assertEqualDiff(
1520
"""Location:
1521
  branch root: %s
1522
1523
Format:
1524
       control: All-in-one format 6
1525
  working tree: Working tree format 2
1526
        branch: Branch format 4
1527
    repository: %s
1528
1529
In the working tree:
1530
         0 unchanged
1531
         0 modified
1532
         0 added
1533
         0 removed
1534
         0 renamed
1535
         0 unknown
1536
         0 ignored
1537
         0 versioned subdirectories
1538
1539
Branch history:
1540
         0 revisions
1541
1542
Revision store:
1543
         0 revisions
1544
         0 KiB
1545
""" % (tree.bzrdir.root_transport.base,
1546
       tree.branch.repository._format.get_format_description(),
1547
       ), out)
1548
        self.assertEqual('', err)
1549
        # L L L
1550
        tree.lock_write()
1551
        out, err = self.runbzr('info branch')
1552
        self.assertEqualDiff(
1553
"""Location:
1554
  branch root: %s
1555
1556
Format:
1557
       control: All-in-one format 6
1558
  working tree: Working tree format 2
1559
        branch: Branch format 4
1560
    repository: %s
1561
1562
In the working tree:
1563
         0 unchanged
1564
         0 modified
1565
         0 added
1566
         0 removed
1567
         0 renamed
1568
         0 unknown
1569
         0 ignored
1570
         0 versioned subdirectories
1571
1572
Branch history:
1573
         0 revisions
1574
1575
Revision store:
1576
         0 revisions
1577
         0 KiB
1578
""" % (tree.bzrdir.root_transport.base,
1579
       tree.branch.repository._format.get_format_description(),
1580
       ), out)
1581
        self.assertEqual('', err)
1582
        tree.unlock()