/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

Fix test_commit for use with 2a as the default repository.

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