~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Wouter van Heyst
  • Date: 2005-10-28 20:30:32 UTC
  • mto: (1185.16.143)
  • mto: This revision was merged to the branch mainline in revision 1498.
  • Revision ID: larstiq@larstiq.dyndns.org-20051028203032-94a016293d15f207
Add reinvocation code to ensure setup.py is run by python2.4

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