~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-10 05:26:37 UTC
  • mfrom: (1645.1.1 mergeui)
  • Revision ID: pqm@pqm.ubuntu.com-20060410052637-9c6229889bc13061
Implement single-file merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
"""Tests for the info command of bzr."""
20
20
 
21
21
 
22
 
import bzrlib
23
 
 
24
 
 
25
22
from bzrlib.osutils import format_date
26
23
from bzrlib.tests import TestSkipped
27
24
from bzrlib.tests.blackbox import ExternalBase
29
26
 
30
27
class TestInfo(ExternalBase):
31
28
 
32
 
    def test_info_standalone(self):
33
 
        transport = self.get_transport()
34
 
 
35
 
        # Create initial standalone branch
36
 
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
37
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
38
 
        tree1 = self.make_branch_and_tree('standalone')
39
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
40
 
        self.build_tree(['standalone/a'])
41
 
        tree1.add('a')
42
 
        branch1 = tree1.branch
43
 
        out, err = self.runbzr('info standalone')
44
 
        self.assertEqualDiff(
45
 
"""Location:
46
 
         branch root: %s
47
 
 
48
 
Format:
49
 
       control: All-in-one format 6
50
 
  working tree: Working tree format 2
51
 
        branch: Branch format 4
52
 
    repository: Weave repository format 6
53
 
 
54
 
In the working tree:
55
 
         0 unchanged
56
 
         0 modified
57
 
         1 added
58
 
         0 removed
59
 
         0 renamed
60
 
         0 unknown
61
 
         0 ignored
62
 
         0 versioned subdirectories
63
 
 
64
 
Branch history:
65
 
         0 revisions
66
 
 
67
 
Revision store:
68
 
         0 revisions
69
 
         0 KiB
70
 
""" % branch1.bzrdir.root_transport.base, out)
71
 
        self.assertEqual('', err)
72
 
        tree1.commit('commit one')
73
 
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
74
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
75
 
 
76
 
        # Branch standalone with push location
77
 
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
78
 
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
79
 
        out, err = self.runbzr('info branch --verbose')
80
 
        self.assertEqualDiff(
81
 
"""Location:
82
 
         branch root: %s
83
 
       parent branch: %s
84
 
      push to branch: %s
85
 
 
86
 
Format:
87
 
       control: All-in-one format 6
88
 
  working tree: Working tree format 2
89
 
        branch: Branch format 4
90
 
    repository: Weave repository format 6
91
 
 
92
 
In the working tree:
93
 
         1 unchanged
94
 
         0 modified
95
 
         0 added
96
 
         0 removed
97
 
         0 renamed
98
 
         0 unknown
99
 
         0 ignored
100
 
         0 versioned subdirectories
101
 
 
102
 
Branch history:
103
 
         1 revision
104
 
         1 committer
105
 
         0 days old
106
 
   first revision: %s
107
 
  latest revision: %s
108
 
 
109
 
Revision store:
110
 
         1 revision
111
 
         0 KiB
112
 
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
113
 
       branch1.bzrdir.root_transport.base,
114
 
       datestring_first, datestring_first), out)
115
 
        self.assertEqual('', err)
116
 
 
117
 
        # Branch and bind to standalone, needs upgrade to metadir
118
 
        # (creates backup as unknown)
119
 
        # XXX: I can't get this to work through API
120
 
        self.runbzr('branch standalone bound')
121
 
        #branch3 = branch1.bzrdir.sprout('bound').open_branch()
122
 
        self.runbzr('upgrade --format=metadir bound')
123
 
        #bzrlib.upgrade.upgrade('bound', 'metadir')
124
 
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
125
 
        branch3.bind(branch1)
126
 
        out, err = self.runbzr('info bound')
127
 
        self.assertEqualDiff(
128
 
"""Location:
129
 
         branch root: %s
130
 
     bound to branch: %s
131
 
       parent branch: %s
132
 
 
133
 
Format:
134
 
       control: Meta directory format 1
135
 
  working tree: Working tree format 3
136
 
        branch: Branch format 5
137
 
    repository: Weave repository format 7
138
 
 
139
 
In the working tree:
140
 
         1 unchanged
141
 
         0 modified
142
 
         0 added
143
 
         0 removed
144
 
         0 renamed
145
 
         1 unknown
146
 
         0 ignored
147
 
         0 versioned subdirectories
148
 
 
149
 
Branch history:
150
 
         1 revision
151
 
         0 days old
152
 
   first revision: %s
153
 
  latest revision: %s
154
 
 
155
 
Revision store:
156
 
         1 revision
157
 
         0 KiB
158
 
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
159
 
       branch1.bzrdir.root_transport.base,
160
 
       datestring_first, datestring_first), out)
161
 
        self.assertEqual('', err)
162
 
 
163
 
        # Checkout standalone (same as above, but does not have parent set)
164
 
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
165
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
166
 
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
167
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
168
 
        branch4.bind(branch1)
169
 
        branch4.bzrdir.open_workingtree().update()
170
 
        out, err = self.runbzr('info checkout --verbose')
171
 
        self.assertEqualDiff(
172
 
"""Location:
173
 
         branch root: %s
174
 
     bound to branch: %s
175
 
 
176
 
Format:
177
 
       control: Meta directory format 1
178
 
  working tree: Working tree format 3
179
 
        branch: Branch format 5
180
 
    repository: Weave repository format 7
181
 
 
182
 
In the working tree:
183
 
         1 unchanged
184
 
         0 modified
185
 
         0 added
186
 
         0 removed
187
 
         0 renamed
188
 
         0 unknown
189
 
         0 ignored
190
 
         0 versioned subdirectories
191
 
 
192
 
Branch history:
193
 
         1 revision
194
 
         1 committer
195
 
         0 days old
196
 
   first revision: %s
197
 
  latest revision: %s
198
 
 
199
 
Revision store:
200
 
         1 revision
201
 
         0 KiB
202
 
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
203
 
       datestring_first, datestring_first), out)
204
 
        self.assertEqual('', err)
205
 
 
206
 
        # Lightweight checkout (same as above, different branch and repository)
207
 
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
208
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
209
 
        transport.mkdir('lightcheckout')
210
 
        dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
211
 
        bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
212
 
        dir5.create_workingtree()
213
 
        tree5 = dir5.open_workingtree()
214
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
215
 
        branch5 = tree5.branch
216
 
        out, err = self.runbzr('info lightcheckout')
217
 
        self.assertEqualDiff(
218
 
"""Location:
219
 
       checkout root: %s
220
 
  checkout of branch: %s
221
 
 
222
 
Format:
223
 
       control: Meta directory format 1
224
 
  working tree: Working tree format 3
225
 
        branch: Branch format 4
226
 
    repository: Weave repository format 6
227
 
 
228
 
In the working tree:
229
 
         1 unchanged
230
 
         0 modified
231
 
         0 added
232
 
         0 removed
233
 
         0 renamed
234
 
         0 unknown
235
 
         0 ignored
236
 
         0 versioned subdirectories
237
 
 
238
 
Branch history:
239
 
         1 revision
240
 
         0 days old
241
 
   first revision: %s
242
 
  latest revision: %s
243
 
 
244
 
Revision store:
245
 
         1 revision
246
 
         0 KiB
247
 
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
248
 
       datestring_first, datestring_first), out)
249
 
        self.assertEqual('', err)
250
 
 
251
 
        # Update initial standalone branch
252
 
        self.build_tree(['standalone/b'])
253
 
        tree1.add('b')
254
 
        tree1.commit('commit two')
255
 
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
256
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
257
 
 
258
 
        # Out of date branched standalone branch will not be detected
259
 
        out, err = self.runbzr('info branch')
260
 
        self.assertEqualDiff(
261
 
"""Location:
262
 
         branch root: %s
263
 
       parent branch: %s
264
 
      push to branch: %s
265
 
 
266
 
Format:
267
 
       control: All-in-one format 6
268
 
  working tree: Working tree format 2
269
 
        branch: Branch format 4
270
 
    repository: Weave repository format 6
271
 
 
272
 
In the working tree:
273
 
         1 unchanged
274
 
         0 modified
275
 
         0 added
276
 
         0 removed
277
 
         0 renamed
278
 
         0 unknown
279
 
         0 ignored
280
 
         0 versioned subdirectories
281
 
 
282
 
Branch history:
283
 
         1 revision
284
 
         0 days old
285
 
   first revision: %s
286
 
  latest revision: %s
287
 
 
288
 
Revision store:
289
 
         1 revision
290
 
         0 KiB
291
 
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
292
 
       branch1.bzrdir.root_transport.base,
293
 
       datestring_first, datestring_first), out)
294
 
        self.assertEqual('', err)
295
 
 
296
 
        # Out of date bound branch
297
 
        out, err = self.runbzr('info bound')
298
 
        self.assertEqualDiff(
299
 
"""Location:
300
 
         branch root: %s
301
 
     bound to branch: %s
302
 
       parent branch: %s
303
 
 
304
 
Format:
305
 
       control: Meta directory format 1
306
 
  working tree: Working tree format 3
307
 
        branch: Branch format 5
308
 
    repository: Weave repository format 7
309
 
 
310
 
Branch is out of date: missing 1 revision.
311
 
 
312
 
In the working tree:
313
 
         1 unchanged
314
 
         0 modified
315
 
         0 added
316
 
         0 removed
317
 
         0 renamed
318
 
         1 unknown
319
 
         0 ignored
320
 
         0 versioned subdirectories
321
 
 
322
 
Branch history:
323
 
         1 revision
324
 
         0 days old
325
 
   first revision: %s
326
 
  latest revision: %s
327
 
 
328
 
Revision store:
329
 
         1 revision
330
 
         0 KiB
331
 
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
332
 
       branch1.bzrdir.root_transport.base,
333
 
       datestring_first, datestring_first), out)
334
 
        self.assertEqual('', err)
335
 
 
336
 
        # Out of date checkout
337
 
        out, err = self.runbzr('info checkout')
338
 
        self.assertEqualDiff(
339
 
"""Location:
340
 
         branch root: %s
341
 
     bound to branch: %s
342
 
 
343
 
Format:
344
 
       control: Meta directory format 1
345
 
  working tree: Working tree format 3
346
 
        branch: Branch format 5
347
 
    repository: Weave repository format 7
348
 
 
349
 
Branch is out of date: missing 1 revision.
350
 
 
351
 
In the working tree:
352
 
         1 unchanged
353
 
         0 modified
354
 
         0 added
355
 
         0 removed
356
 
         0 renamed
357
 
         0 unknown
358
 
         0 ignored
359
 
         0 versioned subdirectories
360
 
 
361
 
Branch history:
362
 
         1 revision
363
 
         0 days old
364
 
   first revision: %s
365
 
  latest revision: %s
366
 
 
367
 
Revision store:
368
 
         1 revision
369
 
         0 KiB
370
 
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
371
 
       datestring_first, datestring_first), out)
372
 
        self.assertEqual('', err)
373
 
 
374
 
        # Out of date lightweight checkout
375
 
        out, err = self.runbzr('info lightcheckout --verbose')
376
 
        self.assertEqualDiff(
377
 
"""Location:
378
 
       checkout root: %s
379
 
  checkout of branch: %s
380
 
 
381
 
Format:
382
 
       control: Meta directory format 1
383
 
  working tree: Working tree format 3
384
 
        branch: Branch format 4
385
 
    repository: Weave repository format 6
386
 
 
387
 
Working tree is out of date: missing 1 revision.
388
 
 
389
 
In the working tree:
390
 
         1 unchanged
391
 
         0 modified
392
 
         0 added
393
 
         0 removed
394
 
         0 renamed
395
 
         0 unknown
396
 
         0 ignored
397
 
         0 versioned subdirectories
398
 
 
399
 
Branch history:
400
 
         2 revisions
401
 
         1 committer
402
 
         0 days old
403
 
   first revision: %s
404
 
  latest revision: %s
405
 
 
406
 
Revision store:
407
 
         2 revisions
408
 
         0 KiB
409
 
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
410
 
       datestring_first, datestring_last), out)
411
 
        self.assertEqual('', err)
412
 
 
413
 
    def test_info_shared_repository(self):
414
 
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
415
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
416
 
        transport = self.get_transport()
417
 
 
418
 
        # Create shared repository
419
 
        repo = self.make_repository('repo', shared=True)
420
 
        repo.set_make_working_trees(False)
421
 
        out, err = self.runbzr('info repo')
422
 
        self.assertEqualDiff(
423
 
"""Location:
424
 
   shared repository: %s
425
 
 
426
 
Format:
427
 
       control: Meta directory format 1
428
 
    repository: Weave repository format 7
429
 
 
430
 
Revision store:
431
 
         0 revisions
432
 
         0 KiB
433
 
""" % repo.bzrdir.root_transport.base, out)
434
 
        self.assertEqual('', err)
435
 
 
436
 
        # Create branch inside shared repository
437
 
        repo.bzrdir.root_transport.mkdir('branch')
438
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
439
 
        out, err = self.runbzr('info repo/branch')
440
 
        self.assertEqualDiff(
441
 
"""Location:
442
 
         branch root: %s
443
 
   shared repository: %s
444
 
 
445
 
Format:
446
 
       control: Meta directory format 1
447
 
        branch: Branch format 5
448
 
    repository: Weave repository format 7
449
 
 
450
 
Branch history:
451
 
         0 revisions
452
 
 
453
 
Revision store:
454
 
         0 revisions
455
 
         0 KiB
456
 
""" % (branch1.bzrdir.root_transport.base,
457
 
       repo.bzrdir.root_transport.base), out)
458
 
        self.assertEqual('', err)
459
 
 
460
 
        # Create lightweight checkout
461
 
        transport.mkdir('tree')
462
 
        transport.mkdir('tree/lightcheckout')
463
 
        dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
464
 
        bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
465
 
        dir2.create_workingtree()
466
 
        tree2 = dir2.open_workingtree()
467
 
        branch2 = tree2.branch
468
 
        out, err = self.runbzr('info tree/lightcheckout')
469
 
        self.assertEqualDiff(
470
 
"""Location:
471
 
       checkout root: %s
472
 
  checkout of branch: %s
473
 
   shared repository: %s
474
 
 
475
 
Format:
476
 
       control: Meta directory format 1
477
 
  working tree: Working tree format 3
478
 
        branch: Branch format 5
479
 
    repository: Weave repository format 7
480
 
 
481
 
In the working tree:
482
 
         0 unchanged
483
 
         0 modified
484
 
         0 added
485
 
         0 removed
486
 
         0 renamed
487
 
         0 unknown
488
 
         0 ignored
489
 
         0 versioned subdirectories
490
 
 
491
 
Branch history:
492
 
         0 revisions
493
 
 
494
 
Revision store:
495
 
         0 revisions
496
 
         0 KiB
497
 
""" % (tree2.bzrdir.root_transport.base,
498
 
       branch1.bzrdir.root_transport.base,
499
 
       repo.bzrdir.root_transport.base), out)
500
 
        self.assertEqual('', err)
501
 
 
502
 
        # Create normal checkout
503
 
        branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
504
 
        branch3.bind(branch1)
505
 
        tree3 = branch3.bzrdir.open_workingtree()
506
 
        tree3.update()
507
 
        out, err = self.runbzr('info tree/checkout --verbose')
508
 
        self.assertEqualDiff(
509
 
"""Location:
510
 
         branch root: %s
511
 
     bound to branch: %s
512
 
 
513
 
Format:
514
 
       control: Meta directory format 1
515
 
  working tree: Working tree format 3
516
 
        branch: Branch format 5
517
 
    repository: Weave repository format 7
518
 
 
519
 
In the working tree:
520
 
         0 unchanged
521
 
         0 modified
522
 
         0 added
523
 
         0 removed
524
 
         0 renamed
525
 
         0 unknown
526
 
         0 ignored
527
 
         0 versioned subdirectories
528
 
 
529
 
Branch history:
530
 
         0 revisions
531
 
         0 committers
532
 
 
533
 
Revision store:
534
 
         0 revisions
535
 
         0 KiB
536
 
""" % (branch3.bzrdir.root_transport.base,
537
 
       branch1.bzrdir.root_transport.base), out)
538
 
        self.assertEqual('', err)
539
 
 
540
 
        # Update lightweight checkout
541
 
        self.build_tree(['tree/lightcheckout/a'])
542
 
        tree2.add('a')
543
 
        tree2.commit('commit one')
544
 
        rev = repo.get_revision(branch2.revision_history()[0])
545
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
546
 
        out, err = self.runbzr('info tree/lightcheckout --verbose')
547
 
        self.assertEqualDiff(
548
 
"""Location:
549
 
       checkout root: %s
550
 
  checkout of branch: %s
551
 
   shared repository: %s
552
 
 
553
 
Format:
554
 
       control: Meta directory format 1
555
 
  working tree: Working tree format 3
556
 
        branch: Branch format 5
557
 
    repository: Weave repository format 7
558
 
 
559
 
In the working tree:
560
 
         1 unchanged
561
 
         0 modified
562
 
         0 added
563
 
         0 removed
564
 
         0 renamed
565
 
         0 unknown
566
 
         0 ignored
567
 
         0 versioned subdirectories
568
 
 
569
 
Branch history:
570
 
         1 revision
571
 
         1 committer
572
 
         0 days old
573
 
   first revision: %s
574
 
  latest revision: %s
575
 
 
576
 
Revision store:
577
 
         1 revision
578
 
         0 KiB
579
 
""" % (tree2.bzrdir.root_transport.base,
580
 
       branch1.bzrdir.root_transport.base,
581
 
       repo.bzrdir.root_transport.base,
582
 
       datestring_first, datestring_first), out)
583
 
        self.assertEqual('', err)
584
 
 
585
 
        # Out of date checkout
586
 
        out, err = self.runbzr('info tree/checkout')
587
 
        self.assertEqualDiff(
588
 
"""Location:
589
 
         branch root: %s
590
 
     bound to branch: %s
591
 
 
592
 
Format:
593
 
       control: Meta directory format 1
594
 
  working tree: Working tree format 3
595
 
        branch: Branch format 5
596
 
    repository: Weave repository format 7
597
 
 
598
 
Branch is out of date: missing 1 revision.
599
 
 
600
 
In the working tree:
601
 
         0 unchanged
602
 
         0 modified
603
 
         0 added
604
 
         0 removed
605
 
         0 renamed
606
 
         0 unknown
607
 
         0 ignored
608
 
         0 versioned subdirectories
609
 
 
610
 
Branch history:
611
 
         0 revisions
612
 
 
613
 
Revision store:
614
 
         0 revisions
615
 
         0 KiB
616
 
""" % (tree3.bzrdir.root_transport.base,
617
 
       branch1.bzrdir.root_transport.base), out)
618
 
        self.assertEqual('', err)
619
 
 
620
 
        # Update checkout
621
 
        tree3.update()
622
 
        self.build_tree(['tree/checkout/b'])
623
 
        tree3.add('b')
624
 
        out, err = self.runbzr('info tree/checkout --verbose')
625
 
        self.assertEqualDiff(
626
 
"""Location:
627
 
         branch root: %s
628
 
     bound to branch: %s
629
 
 
630
 
Format:
631
 
       control: Meta directory format 1
632
 
  working tree: Working tree format 3
633
 
        branch: Branch format 5
634
 
    repository: Weave repository format 7
635
 
 
636
 
In the working tree:
637
 
         1 unchanged
638
 
         0 modified
639
 
         1 added
640
 
         0 removed
641
 
         0 renamed
642
 
         0 unknown
643
 
         0 ignored
644
 
         0 versioned subdirectories
645
 
 
646
 
Branch history:
647
 
         1 revision
648
 
         1 committer
649
 
         0 days old
650
 
   first revision: %s
651
 
  latest revision: %s
652
 
 
653
 
Revision store:
654
 
         1 revision
655
 
         0 KiB
656
 
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
657
 
       datestring_first, datestring_first), out)
658
 
        self.assertEqual('', err)
659
 
        tree3.commit('commit two')
660
 
 
661
 
        # Out of date lightweight checkout
662
 
        rev = repo.get_revision(branch1.revision_history()[-1])
663
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
664
 
        out, err = self.runbzr('info tree/lightcheckout --verbose')
665
 
        self.assertEqualDiff(
666
 
"""Location:
667
 
       checkout root: %s
668
 
  checkout of branch: %s
669
 
   shared repository: %s
670
 
 
671
 
Format:
672
 
       control: Meta directory format 1
673
 
  working tree: Working tree format 3
674
 
        branch: Branch format 5
675
 
    repository: Weave repository format 7
676
 
 
677
 
Working tree is out of date: missing 1 revision.
678
 
 
679
 
In the working tree:
680
 
         1 unchanged
681
 
         0 modified
682
 
         0 added
683
 
         0 removed
684
 
         0 renamed
685
 
         0 unknown
686
 
         0 ignored
687
 
         0 versioned subdirectories
688
 
 
689
 
Branch history:
690
 
         2 revisions
691
 
         1 committer
692
 
         0 days old
693
 
   first revision: %s
694
 
  latest revision: %s
695
 
 
696
 
Revision store:
697
 
         2 revisions
698
 
         0 KiB
699
 
""" % (tree2.bzrdir.root_transport.base,
700
 
       branch1.bzrdir.root_transport.base,
701
 
       repo.bzrdir.root_transport.base,
702
 
       datestring_first, datestring_last), out)
703
 
        self.assertEqual('', err)
704
 
 
705
 
        # Show info about shared branch
706
 
        out, err = self.runbzr('info repo/branch --verbose')
707
 
        self.assertEqualDiff(
708
 
"""Location:
709
 
         branch root: %s
710
 
   shared repository: %s
711
 
 
712
 
Format:
713
 
       control: Meta directory format 1
714
 
        branch: Branch format 5
715
 
    repository: Weave repository format 7
716
 
 
717
 
Branch history:
718
 
         2 revisions
719
 
         1 committer
720
 
         0 days old
721
 
   first revision: %s
722
 
  latest revision: %s
723
 
 
724
 
Revision store:
725
 
         2 revisions
726
 
         0 KiB
727
 
""" % (branch1.bzrdir.root_transport.base,
728
 
       repo.bzrdir.root_transport.base,
729
 
       datestring_first, datestring_last), out)
730
 
        self.assertEqual('', err)
731
 
 
732
 
        # Show info about repository with revisions
733
 
        out, err = self.runbzr('info repo')
734
 
        self.assertEqualDiff(
735
 
"""Location:
736
 
   shared repository: %s
737
 
 
738
 
Format:
739
 
       control: Meta directory format 1
740
 
    repository: Weave repository format 7
741
 
 
742
 
Revision store:
743
 
         2 revisions
744
 
         0 KiB
745
 
""" % repo.bzrdir.root_transport.base, out)
746
 
        self.assertEqual('', err)
747
 
 
748
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
749
 
 
750
 
    def test_info_shared_repository_with_trees(self):
751
 
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
752
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
753
 
        transport = self.get_transport()
754
 
 
755
 
        # Create shared repository with working trees
756
 
        repo = self.make_repository('repo', shared=True)
757
 
        repo.set_make_working_trees(True)
758
 
        out, err = self.runbzr('info repo')
759
 
        self.assertEqualDiff(
760
 
"""Location:
761
 
   shared repository: %s
762
 
 
763
 
Format:
764
 
       control: Meta directory format 1
765
 
    repository: Weave repository format 7
766
 
 
767
 
Create working tree for new branches inside the repository.
768
 
 
769
 
Revision store:
770
 
         0 revisions
771
 
         0 KiB
772
 
""" % repo.bzrdir.root_transport.base, out)
773
 
        self.assertEqual('', err)
774
 
 
775
 
        # Create two branches
776
 
        repo.bzrdir.root_transport.mkdir('branch1')
777
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
778
 
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
779
 
 
780
 
        # Empty first branch
781
 
        out, err = self.runbzr('info repo/branch1 --verbose')
782
 
        self.assertEqualDiff(
783
 
"""Location:
784
 
         branch root: %s
785
 
   shared repository: %s
786
 
 
787
 
Format:
788
 
       control: Meta directory format 1
789
 
  working tree: Working tree format 3
790
 
        branch: Branch format 5
791
 
    repository: Weave repository format 7
792
 
 
793
 
In the working tree:
794
 
         0 unchanged
795
 
         0 modified
796
 
         0 added
797
 
         0 removed
798
 
         0 renamed
799
 
         0 unknown
800
 
         0 ignored
801
 
         0 versioned subdirectories
802
 
 
803
 
Branch history:
804
 
         0 revisions
805
 
         0 committers
806
 
 
807
 
Revision store:
808
 
         0 revisions
809
 
         0 KiB
810
 
""" % (branch1.bzrdir.root_transport.base,
811
 
       repo.bzrdir.root_transport.base), out)
812
 
        self.assertEqual('', err)
813
 
 
814
 
        # Update first branch
815
 
        self.build_tree(['repo/branch1/a'])
816
 
        tree1 = branch1.bzrdir.open_workingtree()
817
 
        tree1.add('a')
818
 
        tree1.commit('commit one')
819
 
        rev = repo.get_revision(branch1.revision_history()[0])
820
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
821
 
        out, err = self.runbzr('info repo/branch1')
822
 
        self.assertEqualDiff(
823
 
"""Location:
824
 
         branch root: %s
825
 
   shared repository: %s
826
 
 
827
 
Format:
828
 
       control: Meta directory format 1
829
 
  working tree: Working tree format 3
830
 
        branch: Branch format 5
831
 
    repository: Weave repository format 7
832
 
 
833
 
In the working tree:
834
 
         1 unchanged
835
 
         0 modified
836
 
         0 added
837
 
         0 removed
838
 
         0 renamed
839
 
         0 unknown
840
 
         0 ignored
841
 
         0 versioned subdirectories
842
 
 
843
 
Branch history:
844
 
         1 revision
845
 
         0 days old
846
 
   first revision: %s
847
 
  latest revision: %s
848
 
 
849
 
Revision store:
850
 
         1 revision
851
 
         0 KiB
852
 
""" % (branch1.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
853
 
       datestring_first, datestring_first), out)
854
 
        self.assertEqual('', err)
855
 
 
856
 
        # Out of date second branch
857
 
        out, err = self.runbzr('info repo/branch2 --verbose')
858
 
        self.assertEqualDiff(
859
 
"""Location:
860
 
         branch root: %s
861
 
   shared repository: %s
862
 
       parent branch: %s
863
 
 
864
 
Format:
865
 
       control: Meta directory format 1
866
 
  working tree: Working tree format 3
867
 
        branch: Branch format 5
868
 
    repository: Weave repository format 7
869
 
 
870
 
In the working tree:
871
 
         0 unchanged
872
 
         0 modified
873
 
         0 added
874
 
         0 removed
875
 
         0 renamed
876
 
         0 unknown
877
 
         0 ignored
878
 
         0 versioned subdirectories
879
 
 
880
 
Branch history:
881
 
         0 revisions
882
 
         0 committers
883
 
 
884
 
Revision store:
885
 
         1 revision
886
 
         0 KiB
887
 
""" % (branch2.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
888
 
       branch1.bzrdir.root_transport.base), out)
889
 
        self.assertEqual('', err)
890
 
 
891
 
        # Update second branch
892
 
        tree2 = branch2.bzrdir.open_workingtree()
893
 
        tree2.pull(branch1)
894
 
        out, err = self.runbzr('info repo/branch2')
895
 
        self.assertEqualDiff(
896
 
"""Location:
897
 
         branch root: %s
898
 
   shared repository: %s
899
 
       parent branch: %s
900
 
 
901
 
Format:
902
 
       control: Meta directory format 1
903
 
  working tree: Working tree format 3
904
 
        branch: Branch format 5
905
 
    repository: Weave repository format 7
906
 
 
907
 
In the working tree:
908
 
         1 unchanged
909
 
         0 modified
910
 
         0 added
911
 
         0 removed
912
 
         0 renamed
913
 
         0 unknown
914
 
         0 ignored
915
 
         0 versioned subdirectories
916
 
 
917
 
Branch history:
918
 
         1 revision
919
 
         0 days old
920
 
   first revision: %s
921
 
  latest revision: %s
922
 
 
923
 
Revision store:
924
 
         1 revision
925
 
         0 KiB
926
 
""" % (branch2.bzrdir.root_transport.base,
927
 
       repo.bzrdir.root_transport.base,
928
 
       branch1.bzrdir.root_transport.base,
929
 
       datestring_first, datestring_first), out)
930
 
        self.assertEqual('', err)
931
 
 
932
 
        # Show info about repository with revisions
933
 
        out, err = self.runbzr('info repo')
934
 
        self.assertEqualDiff(
935
 
"""Location:
936
 
   shared repository: %s
937
 
 
938
 
Format:
939
 
       control: Meta directory format 1
940
 
    repository: Weave repository format 7
941
 
 
942
 
Create working tree for new branches inside the repository.
943
 
 
944
 
Revision store:
945
 
         1 revision
946
 
         0 KiB
947
 
""" % repo.bzrdir.root_transport.base, out)
948
 
        self.assertEqual('', err)
949
 
 
950
 
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
 
29
    def test_info_standalone_trivial(self):
 
30
        self.runbzr("init")
 
31
        out, err = self.runbzr('info')
 
32
        self.assertEqualDiff(
 
33
"""branch format: Bazaar-NG branch, format 6
 
34
 
 
35
in the working tree:
 
36
         0 unchanged
 
37
         0 modified
 
38
         0 added
 
39
         0 removed
 
40
         0 renamed
 
41
         0 unknown
 
42
         0 ignored
 
43
         0 versioned subdirectories
 
44
 
 
45
branch history:
 
46
         0 revisions
 
47
         0 committers
 
48
 
 
49
revision store:
 
50
         0 revisions
 
51
         0 kB
 
52
""",
 
53
        out)
 
54
        self.assertEqual('', err)
 
55
 
 
56
    def test_info_up_to_date_checkout(self):
 
57
        a_branch = self.make_branch_and_tree('branch')
 
58
        self.runbzr('checkout branch checkout')
 
59
        out, err = self.runbzr('info checkout')
 
60
        self.assertEqualDiff(
 
61
"""branch format: Bazaar-NG Metadir branch format 5
 
62
bound to branch: %s
 
63
 
 
64
in the working tree:
 
65
         0 unchanged
 
66
         0 modified
 
67
         0 added
 
68
         0 removed
 
69
         0 renamed
 
70
         0 unknown
 
71
         0 ignored
 
72
         0 versioned subdirectories
 
73
 
 
74
branch history:
 
75
         0 revisions
 
76
         0 committers
 
77
 
 
78
revision store:
 
79
         0 revisions
 
80
         0 kB
 
81
""" % a_branch.bzrdir.root_transport.base,
 
82
        out)
 
83
        self.assertEqual('', err)
 
84
 
 
85
    def test_info_up_to_date_light_checkout(self):
 
86
        a_branch = self.make_branch_and_tree('branch')
 
87
        self.runbzr('checkout --lightweight branch checkout')
 
88
        out, err = self.runbzr('info checkout')
 
89
        self.assertEqualDiff(
 
90
"""working tree format: Bazaar-NG Working Tree format 3
 
91
branch location: %s
 
92
branch format: Bazaar-NG branch, format 6
 
93
 
 
94
in the working tree:
 
95
         0 unchanged
 
96
         0 modified
 
97
         0 added
 
98
         0 removed
 
99
         0 renamed
 
100
         0 unknown
 
101
         0 ignored
 
102
         0 versioned subdirectories
 
103
 
 
104
branch history:
 
105
         0 revisions
 
106
         0 committers
 
107
 
 
108
revision store:
 
109
         0 revisions
 
110
         0 kB
 
111
""" % a_branch.bzrdir.root_transport.base,
 
112
        out)
 
113
        self.assertEqual('', err)
 
114
 
 
115
    def test_info_out_of_date_standalone_tree(self):
 
116
        # FIXME the default format has to change for this to pass
 
117
        # because it currently uses the branch last-revision marker.
 
118
        raise TestSkipped('default format too old')
 
119
        self.make_branch_and_tree('branch')
 
120
        # make a checkout
 
121
        self.runbzr('checkout branch checkout')
 
122
        self.build_tree(['checkout/file'])
 
123
        self.runbzr('add checkout/file')
 
124
        self.runbzr('commit -m add-file checkout')
 
125
        # now branch should be out of date
 
126
        out,err = self.runbzr('update branch')
 
127
        self.assertEqualDiff(
 
128
"""branch format: Bazaar-NG branch, format 6
 
129
 
 
130
Working tree is out of date: missing 1 revision.
 
131
in the working tree:
 
132
         0 unchanged
 
133
         0 modified
 
134
         0 added
 
135
         0 removed
 
136
         0 renamed
 
137
         0 unknown
 
138
         0 ignored
 
139
         0 versioned subdirectories
 
140
 
 
141
branch history:
 
142
         0 revisions
 
143
         0 committers
 
144
 
 
145
revision store:
 
146
         0 revisions
 
147
         0 kB
 
148
""" % a_branch.bzrdir.root_transport.base,
 
149
        out)
 
150
        self.assertEqual('', err)
 
151
 
 
152
    def test_info_out_of_date_checkout(self):
 
153
        # note this deliberately uses a checkout at 'None' to 
 
154
        # test the out of date message with a revision notin the 
 
155
        # revision history.
 
156
        a_branch = self.make_branch('branch')
 
157
        # make two checkouts
 
158
        self.runbzr('checkout branch checkout')
 
159
        self.runbzr('checkout branch checkout2')
 
160
        self.build_tree(['checkout/file'])
 
161
        self.runbzr('add checkout/file')
 
162
        self.runbzr('commit -m add-file checkout')
 
163
        # now checkout2 should be out of date
 
164
        out,err = self.runbzr('info checkout2')
 
165
        rev = a_branch.repository.get_revision(a_branch.revision_history()[0])
 
166
        datestring = format_date(rev.timestamp, rev.timezone)
 
167
        self.assertEqualDiff(
 
168
"""branch format: Bazaar-NG Metadir branch format 5
 
169
bound to branch: %s
 
170
 
 
171
Branch is out of date: missing 1 revision.
 
172
in the working tree:
 
173
         0 unchanged
 
174
         0 modified
 
175
         0 added
 
176
         0 removed
 
177
         0 renamed
 
178
         0 unknown
 
179
         0 ignored
 
180
         0 versioned subdirectories
 
181
 
 
182
branch history:
 
183
         0 revisions
 
184
         0 committers
 
185
 
 
186
revision store:
 
187
         0 revisions
 
188
         0 kB
 
189
""" % (a_branch.bzrdir.root_transport.base,
 
190
       ),
 
191
            out)
 
192
        self.assertEqual('', err)
 
193
 
 
194
    def test_info_out_of_date_light_checkout(self):
 
195
        # note this deliberately uses a checkout at 'None' to 
 
196
        # test the out of date message with a revision notin the 
 
197
        # revision history.
 
198
        a_branch = self.make_branch('branch')
 
199
        # make two checkouts
 
200
        self.runbzr('checkout --lightweight branch checkout')
 
201
        self.runbzr('checkout --lightweight branch checkout2')
 
202
        self.build_tree(['checkout/file'])
 
203
        self.runbzr('add checkout/file')
 
204
        self.runbzr('commit -m add-file checkout')
 
205
        # now checkout2 should be out of date
 
206
        out,err = self.runbzr('info checkout2')
 
207
        rev = a_branch.repository.get_revision(a_branch.revision_history()[0])
 
208
        datestring = format_date(rev.timestamp, rev.timezone)
 
209
        self.assertEqualDiff(
 
210
"""working tree format: Bazaar-NG Working Tree format 3
 
211
branch location: %s
 
212
branch format: Bazaar-NG branch, format 6
 
213
 
 
214
Working tree is out of date: missing 1 revision.
 
215
in the working tree:
 
216
         0 unchanged
 
217
         0 modified
 
218
         0 added
 
219
         0 removed
 
220
         0 renamed
 
221
         0 unknown
 
222
         0 ignored
 
223
         0 versioned subdirectories
 
224
 
 
225
branch history:
 
226
         1 revision
 
227
         1 committer
 
228
         0 days old
 
229
   first revision: %s
 
230
  latest revision: %s
 
231
 
 
232
revision store:
 
233
         1 revision
 
234
         0 kB
 
235
""" % (a_branch.bzrdir.root_transport.base,
 
236
       datestring,
 
237
       datestring,
 
238
       ),
 
239
            out)
 
240
        self.assertEqual('', err)
 
241
 
 
242
    def test_info_parent(self):
 
243
        b = self.make_branch('.')
 
244
        url = 'http://bazaar-vcs.org/bzr/bzr.dev/'
 
245
        b.set_parent(url)
 
246
        out,err = self.runbzr('info')
 
247
        self.assertEqualDiff(
 
248
"""branch format: Bazaar-NG branch, format 6
 
249
 
 
250
in the working tree:
 
251
         0 unchanged
 
252
         0 modified
 
253
         0 added
 
254
         0 removed
 
255
         0 renamed
 
256
         0 unknown
 
257
         0 ignored
 
258
         0 versioned subdirectories
 
259
 
 
260
branch history:
 
261
         0 revisions
 
262
         0 committers
 
263
 
 
264
revision store:
 
265
         0 revisions
 
266
         0 kB
 
267
 
 
268
parent location:
 
269
  http://bazaar-vcs.org/bzr/bzr.dev/
 
270
""", out)
 
271
        self.assertEqual('', err)
 
272