/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: Martin Pool
  • Date: 2006-05-12 06:59:47 UTC
  • mfrom: (1706 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: mbp@sourcefrog.net-20060512065947-60e259ffea0bf4fb
[merge] bzr.dev

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