/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

  • Committer: John Arbash Meinel
  • Date: 2008-08-01 17:48:30 UTC
  • mto: This revision was merged to the branch mainline in revision 3600.
  • Revision ID: john@arbash-meinel.com-20080801174830-xyg2tor1j4zjklpj
One code path was using a tuple, another a plain path
we need to support *both*. Relatively simple fix after that.

Show diffs side-by-side

added added

removed removed

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