~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2005-09-21 15:33:23 UTC
  • mto: (1185.1.37)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: abentley@panoramicfeedback.com-20050921153323-5db674d572d7649d
Fixed bug in distance-from-root graph operation

Show diffs side-by-side

added added

removed removed

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