~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-03-22 19:21:20 UTC
  • mto: (1668.1.8 bzr-0.8.mbp)
  • mto: This revision was merged to the branch mainline in revision 1710.
  • Revision ID: mbp@sourcefrog.net-20060322192120-133f1e99d4c79477
Update xmlrpc api

Prompt for user password when registering

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