~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_info.py

  • Committer: John Arbash Meinel
  • Date: 2005-11-30 15:43:57 UTC
  • mto: (1185.50.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1518.
  • Revision ID: john@arbash-meinel.com-20051130154357-614206b3a7b83cd0
Refactored bzrlib/ui.py into a module with the possibility for multiple ui forms.

Show diffs side-by-side

added added

removed removed

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