/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: Robert Collins
  • Date: 2007-11-22 02:09:49 UTC
  • mto: This revision was merged to the branch mainline in revision 3014.
  • Revision ID: robertc@robertcollins.net-20071122020949-kpvph7srqw3h60p1
Handle packs in blackbox.test_reconcile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
18
"""Tests for the info command of bzr."""
19
19
 
 
20
import os
20
21
import sys
21
22
 
 
23
import bzrlib
22
24
from bzrlib import (
23
 
    branch,
24
25
    bzrdir,
25
26
    errors,
26
27
    info,
27
28
    osutils,
28
 
    tests,
29
 
    upgrade,
 
29
    repository,
30
30
    urlutils,
31
31
    )
32
 
from bzrlib.transport import memory
33
 
 
34
 
 
35
 
class TestInfo(tests.TestCaseWithTransport):
36
 
 
37
 
    def setUp(self):
38
 
        super(TestInfo, self).setUp()
39
 
        self._repo_strings = "2a"
 
32
from bzrlib.osutils import format_date
 
33
from bzrlib.tests import TestSkipped
 
34
from bzrlib.tests.blackbox import ExternalBase
 
35
 
 
36
 
 
37
class TestInfo(ExternalBase):
40
38
 
41
39
    def test_info_non_existing(self):
42
 
        self.vfs_transport_factory = memory.MemoryServer
43
 
        location = self.get_url()
 
40
        if sys.platform == "win32":
 
41
            location = "C:/i/do/not/exist/"
 
42
        else:
 
43
            location = "/i/do/not/exist/"
44
44
        out, err = self.run_bzr('info '+location, retcode=3)
45
45
        self.assertEqual(out, '')
46
46
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
62
62
""", out)
63
63
        self.assertEqual('', err)
64
64
 
65
 
        # Standalone branch - verbose mode
66
65
        out, err = self.run_bzr('info standalone -v')
67
66
        self.assertEqualDiff(
68
67
"""Standalone tree (format: weave)
87
86
 
88
87
Branch history:
89
88
         0 revisions
90
 
 
91
 
Repository:
92
 
         0 revisions
93
 
""", out)
94
 
        self.assertEqual('', err)
95
 
 
96
 
        # Standalone branch - really verbose mode
97
 
        out, err = self.run_bzr('info standalone -vv')
98
 
        self.assertEqualDiff(
99
 
"""Standalone tree (format: weave)
100
 
Location:
101
 
  branch root: standalone
102
 
 
103
 
Format:
104
 
       control: All-in-one format 6
105
 
  working tree: Working tree format 2
106
 
        branch: Branch format 4
107
 
    repository: Weave repository format 6
108
 
 
109
 
In the working tree:
110
 
         0 unchanged
111
 
         0 modified
112
 
         1 added
113
 
         0 removed
114
 
         0 renamed
115
 
         0 unknown
116
 
         0 ignored
117
 
         0 versioned subdirectories
118
 
 
119
 
Branch history:
120
 
         0 revisions
121
89
         0 committers
122
90
 
123
91
Repository:
124
92
         0 revisions
 
93
         0 KiB
125
94
""", out)
126
95
        self.assertEqual('', err)
127
96
        tree1.commit('commit one')
128
97
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
129
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
98
        datestring_first = format_date(rev.timestamp, rev.timezone)
130
99
 
131
100
        # Branch standalone with push location
132
101
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
172
141
 
173
142
Branch history:
174
143
         1 revision
 
144
         1 committer
175
145
         0 days old
176
146
   first revision: %s
177
147
  latest revision: %s
178
148
 
179
149
Repository:
180
150
         1 revision
 
151
         %d KiB
181
152
""" % (datestring_first, datestring_first,
 
153
       # poking at _revision_store isn't all that clean, but neither is
 
154
       # having the ui test dependent on the exact overhead of a given store.
 
155
       branch2.repository._revision_store.total_size(
 
156
        branch2.repository.get_transaction())[1] / 1024,
182
157
       ), out)
183
158
        self.assertEqual('', err)
184
159
 
186
161
        # (creates backup as unknown)
187
162
        branch1.bzrdir.sprout('bound')
188
163
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
189
 
        upgrade.upgrade('bound', knit1_format)
190
 
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
 
164
        bzrlib.upgrade.upgrade('bound', knit1_format)
 
165
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
191
166
        branch3.bind(branch1)
192
167
        bound_tree = branch3.bzrdir.open_workingtree()
193
168
        out, err = self.run_bzr('info -v bound')
212
187
         0 added
213
188
         0 removed
214
189
         0 renamed
215
 
         0 unknown
216
 
         1 ignored
 
190
         1 unknown
 
191
         0 ignored
217
192
         0 versioned subdirectories
218
193
 
219
194
Branch history:
220
195
         1 revision
 
196
         1 committer
221
197
         0 days old
222
198
   first revision: %s
223
199
  latest revision: %s
224
200
 
225
201
Repository:
226
202
         1 revision
 
203
         %d KiB
227
204
""" % (bound_tree._format.get_format_description(),
228
205
       branch3._format.get_format_description(),
229
206
       branch3.repository._format.get_format_description(),
230
207
       datestring_first, datestring_first,
 
208
       # poking at _revision_store isn't all that clean, but neither is
 
209
       # having the ui test dependent on the exact overhead of a given store.
 
210
       branch3.repository._revision_store.total_size(
 
211
        branch3.repository.get_transaction())[1] / 1024,
231
212
       ), out)
232
213
        self.assertEqual('', err)
233
214
 
234
215
        # Checkout standalone (same as above, but does not have parent set)
235
 
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
 
216
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
236
217
            format=knit1_format)
237
218
        branch4.bind(branch1)
238
219
        branch4.bzrdir.open_workingtree().update()
261
242
 
262
243
Branch history:
263
244
         1 revision
 
245
         1 committer
264
246
         0 days old
265
247
   first revision: %s
266
248
  latest revision: %s
267
249
 
268
250
Repository:
269
251
         1 revision
 
252
         %d KiB
270
253
""" % (branch4.repository._format.get_format_description(),
271
254
       datestring_first, datestring_first,
 
255
       # poking at _revision_store isn't all that clean, but neither is
 
256
       # having the ui test dependent on the exact overhead of a given store.
 
257
       branch4.repository._revision_store.total_size(
 
258
        branch4.repository.get_transaction())[1] / 1024,
272
259
       ), out)
273
260
        self.assertEqual('', err)
274
261
 
277
264
        branch5 = tree5.branch
278
265
        out, err = self.run_bzr('info -v lightcheckout')
279
266
        self.assertEqualDiff(
280
 
"""Lightweight checkout (format: %s)
 
267
"""Lightweight checkout (format: dirstate or dirstate-tags or knitpack-experimental)
281
268
Location:
282
269
  light checkout root: lightcheckout
283
270
   checkout of branch: standalone
284
271
 
285
272
Format:
286
273
       control: Meta directory format 1
287
 
  working tree: Working tree format 6
 
274
  working tree: Working tree format 4
288
275
        branch: Branch format 4
289
276
    repository: Weave repository format 6
290
277
 
300
287
 
301
288
Branch history:
302
289
         1 revision
 
290
         1 committer
303
291
         0 days old
304
292
   first revision: %s
305
293
  latest revision: %s
306
294
 
307
295
Repository:
308
296
         1 revision
309
 
""" % (self._repo_strings, datestring_first, datestring_first,), out)
 
297
         0 KiB
 
298
""" % (datestring_first, datestring_first,), out)
310
299
        self.assertEqual('', err)
311
300
 
312
301
        # Update initial standalone branch
314
303
        tree1.add('b')
315
304
        tree1.commit('commit two')
316
305
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
317
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
306
        datestring_last = format_date(rev.timestamp, rev.timezone)
318
307
 
319
308
        # Out of date branched standalone branch will not be detected
320
309
        out, err = self.run_bzr('info -v branch')
345
334
 
346
335
Branch history:
347
336
         1 revision
 
337
         1 committer
348
338
         0 days old
349
339
   first revision: %s
350
340
  latest revision: %s
351
341
 
352
342
Repository:
353
343
         1 revision
 
344
         0 KiB
354
345
""" % (datestring_first, datestring_first,
355
346
       ), out)
356
347
        self.assertEqual('', err)
380
371
         0 added
381
372
         0 removed
382
373
         0 renamed
383
 
         0 unknown
384
 
         1 ignored
 
374
         1 unknown
 
375
         0 ignored
385
376
         0 versioned subdirectories
386
377
 
387
378
Branch history:
388
379
         1 revision
 
380
         1 committer
389
381
         0 days old
390
382
   first revision: %s
391
383
  latest revision: %s
392
384
 
393
385
Repository:
394
386
         1 revision
 
387
         %d KiB
395
388
""" % (branch3.repository._format.get_format_description(),
396
389
       datestring_first, datestring_first,
 
390
       # poking at _revision_store isn't all that clean, but neither is
 
391
       # having the ui test dependent on the exact overhead of a given store.
 
392
       branch3.repository._revision_store.total_size(
 
393
        branch3.repository.get_transaction())[1] / 1024,
397
394
       ), out)
398
395
        self.assertEqual('', err)
399
396
 
425
422
 
426
423
Branch history:
427
424
         1 revision
 
425
         1 committer
428
426
         0 days old
429
427
   first revision: %s
430
428
  latest revision: %s
431
429
 
432
430
Repository:
433
431
         1 revision
 
432
         %d KiB
434
433
""" % (branch4.repository._format.get_format_description(),
435
434
       datestring_first, datestring_first,
 
435
       # poking at _revision_store isn't all that clean, but neither is
 
436
       # having the ui test dependent on the exact overhead of a given store.
 
437
       branch4.repository._revision_store.total_size(
 
438
        branch4.repository.get_transaction())[1] / 1024,
436
439
       ), out)
437
440
        self.assertEqual('', err)
438
441
 
439
442
        # Out of date lightweight checkout
440
443
        out, err = self.run_bzr('info lightcheckout --verbose')
441
444
        self.assertEqualDiff(
442
 
"""Lightweight checkout (format: %s)
 
445
"""Lightweight checkout (format: dirstate or dirstate-tags or knitpack-experimental)
443
446
Location:
444
447
  light checkout root: lightcheckout
445
448
   checkout of branch: standalone
446
449
 
447
450
Format:
448
451
       control: Meta directory format 1
449
 
  working tree: Working tree format 6
 
452
  working tree: Working tree format 4
450
453
        branch: Branch format 4
451
454
    repository: Weave repository format 6
452
455
 
464
467
 
465
468
Branch history:
466
469
         2 revisions
 
470
         1 committer
467
471
         0 days old
468
472
   first revision: %s
469
473
  latest revision: %s
470
474
 
471
475
Repository:
472
476
         2 revisions
473
 
""" % (self._repo_strings, datestring_first, datestring_last,), out)
 
477
         0 KiB
 
478
""" % (datestring_first, datestring_last,), out)
474
479
        self.assertEqual('', err)
475
480
 
476
481
    def test_info_standalone_no_tree(self):
491
496
 
492
497
Branch history:
493
498
         0 revisions
 
499
         0 committers
494
500
 
495
501
Repository:
496
502
         0 revisions
 
503
         0 KiB
497
504
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
498
505
       format.get_branch_format().get_format_description(),
499
506
       format.repository_format.get_format_description(),
519
526
 
520
527
Repository:
521
528
         0 revisions
 
529
         0 KiB
522
530
""" % ('repo', format.repository_format.get_format_description(),
523
531
       ), out)
524
532
        self.assertEqual('', err)
541
549
 
542
550
Branch history:
543
551
         0 revisions
 
552
         0 committers
544
553
 
545
554
Repository:
546
555
         0 revisions
 
556
         0 KiB
547
557
""" % (format.get_branch_format().get_format_description(),
548
558
       format.repository_format.get_format_description(),
549
559
       ), out)
552
562
        # Create lightweight checkout
553
563
        transport.mkdir('tree')
554
564
        transport.mkdir('tree/lightcheckout')
555
 
        tree2 = branch1.create_checkout('tree/lightcheckout',
 
565
        tree2 = branch1.create_checkout('tree/lightcheckout', 
556
566
            lightweight=True)
557
567
        branch2 = tree2.branch
558
568
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
568
578
        tree2.add('a')
569
579
        tree2.commit('commit one')
570
580
        rev = repo.get_revision(branch2.revision_history()[0])
571
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
581
        datestring_first = format_date(rev.timestamp, rev.timezone)
572
582
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
573
583
        self.assertEqualDiff(
574
 
"""Lightweight checkout (format: %s)
 
584
"""Lightweight checkout (format: dirstate or dirstate-tags or knitpack-experimental)
575
585
Location:
576
586
  light checkout root: tree/lightcheckout
577
587
   checkout of branch: repo/branch
579
589
 
580
590
Format:
581
591
       control: Meta directory format 1
582
 
  working tree: Working tree format 6
 
592
  working tree: Working tree format 4
583
593
        branch: %s
584
594
    repository: %s
585
595
 
595
605
 
596
606
Branch history:
597
607
         1 revision
 
608
         1 committer
598
609
         0 days old
599
610
   first revision: %s
600
611
  latest revision: %s
601
612
 
602
613
Repository:
603
614
         1 revision
604
 
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
 
615
         %d KiB
 
616
""" % (format.get_branch_format().get_format_description(),
605
617
       format.repository_format.get_format_description(),
606
618
       datestring_first, datestring_first,
 
619
       # poking at _revision_store isn't all that clean, but neither is
 
620
       # having the ui test dependent on the exact overhead of a given store.
 
621
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
607
622
       ), out)
608
623
        self.assertEqual('', err)
609
624
 
610
625
        # Out of date checkout
611
626
        out, err = self.run_bzr('info -v tree/checkout')
612
627
        self.assertEqualDiff(
613
 
"""Checkout (format: unnamed)
 
628
"""Checkout (format: dirstate)
614
629
Location:
615
630
       checkout root: tree/checkout
616
631
  checkout of branch: repo/branch
617
632
 
618
633
Format:
619
634
       control: Meta directory format 1
620
 
  working tree: Working tree format 6
 
635
  working tree: Working tree format 4
621
636
        branch: %s
622
637
    repository: %s
623
638
 
635
650
 
636
651
Branch history:
637
652
         0 revisions
 
653
         0 committers
638
654
 
639
655
Repository:
640
656
         0 revisions
 
657
         0 KiB
641
658
""" % (format.get_branch_format().get_format_description(),
642
659
       format.repository_format.get_format_description(),
643
660
       ), out)
649
666
        tree3.add('b')
650
667
        out, err = self.run_bzr('info tree/checkout --verbose')
651
668
        self.assertEqualDiff(
652
 
"""Checkout (format: unnamed)
 
669
"""Checkout (format: dirstate)
653
670
Location:
654
671
       checkout root: tree/checkout
655
672
  checkout of branch: repo/branch
656
673
 
657
674
Format:
658
675
       control: Meta directory format 1
659
 
  working tree: Working tree format 6
 
676
  working tree: Working tree format 4
660
677
        branch: %s
661
678
    repository: %s
662
679
 
672
689
 
673
690
Branch history:
674
691
         1 revision
 
692
         1 committer
675
693
         0 days old
676
694
   first revision: %s
677
695
  latest revision: %s
678
696
 
679
697
Repository:
680
698
         1 revision
 
699
         %d KiB
681
700
""" % (format.get_branch_format().get_format_description(),
682
701
       format.repository_format.get_format_description(),
683
702
       datestring_first, datestring_first,
 
703
       # poking at _revision_store isn't all that clean, but neither is
 
704
       # having the ui test dependent on the exact overhead of a given store.
 
705
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
684
706
       ), out)
685
707
        self.assertEqual('', err)
686
708
        tree3.commit('commit two')
687
709
 
688
710
        # Out of date lightweight checkout
689
711
        rev = repo.get_revision(branch1.revision_history()[-1])
690
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
712
        datestring_last = format_date(rev.timestamp, rev.timezone)
691
713
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
714
        self.assertEqualDiff(
693
 
"""Lightweight checkout (format: %s)
 
715
"""Lightweight checkout (format: dirstate or dirstate-tags or knitpack-experimental)
694
716
Location:
695
717
  light checkout root: tree/lightcheckout
696
718
   checkout of branch: repo/branch
698
720
 
699
721
Format:
700
722
       control: Meta directory format 1
701
 
  working tree: Working tree format 6
 
723
  working tree: Working tree format 4
702
724
        branch: %s
703
725
    repository: %s
704
726
 
716
738
 
717
739
Branch history:
718
740
         2 revisions
 
741
         1 committer
719
742
         0 days old
720
743
   first revision: %s
721
744
  latest revision: %s
722
745
 
723
746
Repository:
724
747
         2 revisions
725
 
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
 
748
         %d KiB
 
749
""" % (format.get_branch_format().get_format_description(),
726
750
       format.repository_format.get_format_description(),
727
751
       datestring_first, datestring_last,
 
752
       # poking at _revision_store isn't all that clean, but neither is
 
753
       # having the ui test dependent on the exact overhead of a given store.
 
754
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
728
755
       ), out)
729
756
        self.assertEqual('', err)
730
757
 
743
770
 
744
771
Branch history:
745
772
         2 revisions
 
773
         1 committer
746
774
         0 days old
747
775
   first revision: %s
748
776
  latest revision: %s
749
777
 
750
778
Repository:
751
779
         2 revisions
 
780
         %d KiB
752
781
""" % (format.get_branch_format().get_format_description(),
753
782
       format.repository_format.get_format_description(),
754
783
       datestring_first, datestring_last,
 
784
       # poking at _revision_store isn't all that clean, but neither is
 
785
       # having the ui test dependent on the exact overhead of a given store.
 
786
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
755
787
       ), out)
756
788
        self.assertEqual('', err)
757
789
 
768
800
 
769
801
Repository:
770
802
         2 revisions
 
803
         %d KiB
771
804
""" % (format.repository_format.get_format_description(),
 
805
       # poking at _revision_store isn't all that clean, but neither is
 
806
       # having the ui test dependent on the exact overhead of a given store.
 
807
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
772
808
       ), out)
773
809
        self.assertEqual('', err)
774
810
 
793
829
 
794
830
Repository:
795
831
         0 revisions
 
832
         0 KiB
796
833
""" % (format.repository_format.get_format_description(),
797
834
       ), out)
798
835
        self.assertEqual('', err)
829
866
 
830
867
Branch history:
831
868
         0 revisions
 
869
         0 committers
832
870
 
833
871
Repository:
834
872
         0 revisions
 
873
         0 KiB
835
874
""" % (format.get_branch_format().get_format_description(),
836
875
       format.repository_format.get_format_description(),
837
876
       ), out)
843
882
        tree1.add('a')
844
883
        tree1.commit('commit one')
845
884
        rev = repo.get_revision(branch1.revision_history()[0])
846
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
885
        datestring_first = format_date(rev.timestamp, rev.timezone)
847
886
        out, err = self.run_bzr('info -v repo/branch1')
848
887
        self.assertEqualDiff(
849
888
"""Repository tree (format: knit)
869
908
 
870
909
Branch history:
871
910
         1 revision
 
911
         1 committer
872
912
         0 days old
873
913
   first revision: %s
874
914
  latest revision: %s
875
915
 
876
916
Repository:
877
917
         1 revision
 
918
         %d KiB
878
919
""" % (format.get_branch_format().get_format_description(),
879
920
       format.repository_format.get_format_description(),
880
921
       datestring_first, datestring_first,
 
922
       # poking at _revision_store isn't all that clean, but neither is
 
923
       # having the ui test dependent on the exact overhead of a given store.
 
924
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
881
925
       ), out)
882
926
        self.assertEqual('', err)
883
927
 
910
954
 
911
955
Branch history:
912
956
         0 revisions
 
957
         0 committers
913
958
 
914
959
Repository:
915
960
         1 revision
 
961
         %d KiB
916
962
""" % (format.get_branch_format().get_format_description(),
917
963
       format.repository_format.get_format_description(),
 
964
       # poking at _revision_store isn't all that clean, but neither is
 
965
       # having the ui test dependent on the exact overhead of a given store.
 
966
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
918
967
       ), out)
919
968
        self.assertEqual('', err)
920
969
 
949
998
 
950
999
Branch history:
951
1000
         1 revision
 
1001
         1 committer
952
1002
         0 days old
953
1003
   first revision: %s
954
1004
  latest revision: %s
955
1005
 
956
1006
Repository:
957
1007
         1 revision
 
1008
         %d KiB
958
1009
""" % (format.get_branch_format().get_format_description(),
959
1010
       format.repository_format.get_format_description(),
960
1011
       datestring_first, datestring_first,
 
1012
       # poking at _revision_store isn't all that clean, but neither is
 
1013
       # having the ui test dependent on the exact overhead of a given store.
 
1014
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
961
1015
       ), out)
962
1016
        self.assertEqual('', err)
963
1017
 
976
1030
 
977
1031
Repository:
978
1032
         1 revision
 
1033
         %d KiB
979
1034
""" % (format.repository_format.get_format_description(),
 
1035
       # poking at _revision_store isn't all that clean, but neither is
 
1036
       # having the ui test dependent on the exact overhead of a given store.
 
1037
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
980
1038
       ),
981
1039
       out)
982
1040
        self.assertEqual('', err)
983
 
 
 
1041
    
984
1042
    def test_info_shared_repository_with_tree_in_root(self):
985
1043
        format = bzrdir.format_registry.make_bzrdir('knit')
986
1044
        transport = self.get_transport()
1002
1060
 
1003
1061
Repository:
1004
1062
         0 revisions
 
1063
         0 KiB
1005
1064
""" % (format.repository_format.get_format_description(),
1006
1065
       ), out)
1007
1066
        self.assertEqual('', err)
1035
1094
 
1036
1095
Branch history:
1037
1096
         0 revisions
 
1097
         0 committers
1038
1098
 
1039
1099
Repository:
1040
1100
         0 revisions
 
1101
         0 KiB
1041
1102
""" % (format.get_branch_format().get_format_description(),
1042
1103
       format.repository_format.get_format_description(),
1043
1104
       ), out)
1044
1105
        self.assertEqual('', err)
1045
1106
 
1046
 
    def test_info_repository_hook(self):
1047
 
        format = bzrdir.format_registry.make_bzrdir('knit')
1048
 
        def repo_info(repo, stats, outf):
1049
 
            outf.write("more info\n")
1050
 
        info.hooks.install_named_hook('repository', repo_info, None)
1051
 
        # Create shared repository with working trees
1052
 
        repo = self.make_repository('repo', shared=True, format=format)
1053
 
        out, err = self.run_bzr('info -v repo')
1054
 
        self.assertEqualDiff(
1055
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1056
 
Location:
1057
 
  shared repository: repo
1058
 
 
1059
 
Format:
1060
 
       control: Meta directory format 1
1061
 
    repository: %s
1062
 
 
1063
 
Create working tree for new branches inside the repository.
1064
 
 
1065
 
Repository:
1066
 
         0 revisions
1067
 
more info
1068
 
""" % (format.repository_format.get_format_description(),
1069
 
       ), out)
1070
 
        self.assertEqual('', err)
1071
 
 
1072
1107
    def assertCheckoutStatusOutput(self,
1073
1108
        command_string, lco_tree, shared_repo=None,
1074
1109
        repo_branch=None,
1084
1119
        allow us, the test writers, to document what *should* be present in
1085
1120
        the output. Removing this separation would remove the value of the
1086
1121
        tests.
1087
 
 
 
1122
        
1088
1123
        :param path: the path to the light checkout.
1089
1124
        :param lco_tree: the tree object for the light checkout.
1090
1125
        :param shared_repo: A shared repository is in use, expect that in
1098
1133
            actually locked then this parameter is overridden. This is because
1099
1134
            pack repositories do not have any public API for obtaining an
1100
1135
            exclusive repository wide lock.
1101
 
        :param verbose: verbosity level: 2 or higher to show committers
 
1136
        :param verbose: If true, expect verbose output
1102
1137
        """
1103
1138
        def friendly_location(url):
1104
1139
            path = urlutils.unescape_for_display(url, 'ascii')
1107
1142
            except errors.PathNotChild:
1108
1143
                return path
1109
1144
 
1110
 
        if tree_locked:
1111
 
            # We expect this to fail because of locking errors.
1112
 
            # (A write-locked file cannot be read-locked
1113
 
            # in the different process -- either on win32 or on linux).
 
1145
        if tree_locked and sys.platform == 'win32':
 
1146
            # We expect this to fail because of locking errors. (A write-locked
 
1147
            # file cannot be read-locked in the same process).
1114
1148
            # This should be removed when the locking errors are fixed.
1115
 
            self.expectFailure('OS locks are exclusive '
1116
 
                'for different processes (Bug #174055)',
1117
 
                self.run_bzr_subprocess,
1118
 
                'info ' + command_string)
 
1149
            self.run_bzr_error([], 'info ' + command_string)
 
1150
            return
1119
1151
        out, err = self.run_bzr('info %s' % command_string)
1120
1152
        description = {
1121
1153
            (True, True): 'Lightweight checkout',
1123
1155
            (False, True): 'Lightweight checkout',
1124
1156
            (False, False): 'Checkout',
1125
1157
            }[(shared_repo is not None, light_checkout)]
1126
 
        format = {True: self._repo_strings,
1127
 
                  False: 'unnamed'}[light_checkout]
 
1158
        format = {True: 'dirstate or dirstate-tags or knitpack-experimental',
 
1159
                  False: 'dirstate'}[light_checkout]
1128
1160
        if repo_locked:
1129
1161
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1130
1162
        if repo_locked or branch_locked or tree_locked:
1167
1199
        else:
1168
1200
            branch_data = ("   checkout of branch: %s\n" %
1169
1201
                lco_tree.branch.bzrdir.root_transport.base)
1170
 
 
1171
 
        if verbose >= 2:
 
1202
        
 
1203
        if verbose:
1172
1204
            verbose_info = '         0 committers\n'
1173
1205
        else:
1174
1206
            verbose_info = ''
1175
 
 
 
1207
            
1176
1208
        self.assertEqualDiff(
1177
1209
"""%s (format: %s)
1178
1210
Location:
1198
1230
%s
1199
1231
Repository:
1200
1232
         0 revisions
 
1233
         0 KiB
1201
1234
""" %  (description,
1202
1235
        format,
1203
1236
        tree_data,
1214
1247
        transport = self.get_transport()
1215
1248
        # Create shared repository with a branch
1216
1249
        repo = self.make_repository('repo', shared=True,
1217
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1250
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1218
1251
        repo.set_make_working_trees(False)
1219
1252
        repo.bzrdir.root_transport.mkdir('branch')
1220
1253
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1254
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1222
1255
        # Do a heavy checkout
1223
1256
        transport.mkdir('tree')
1224
1257
        transport.mkdir('tree/checkout')
1225
 
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
 
            format=bzrdir.BzrDirMetaFormat1())
 
1258
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1259
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
1227
1260
        co_branch.bind(repo_branch)
1228
1261
        # Do a light checkout of the heavy one
1229
1262
        transport.mkdir('tree/lightcheckout')
1230
 
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
 
        branch.BranchReferenceFormat().initialize(lco_dir,
1232
 
            target_branch=co_branch)
 
1263
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1264
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1233
1265
        lco_dir.create_workingtree()
1234
1266
        lco_tree = lco_dir.open_workingtree()
1235
1267
 
1325
1357
 
1326
1358
    def test_info_locking_oslocks(self):
1327
1359
        if sys.platform == "win32":
1328
 
            self.skip("don't use oslocks on win32 in unix manner")
1329
 
        # This test tests old (all-in-one, OS lock using) behaviour which
1330
 
        # simply cannot work on windows (and is indeed why we changed our
1331
 
        # design. As such, don't try to remove the thisFailsStrictLockCheck
1332
 
        # call here.
1333
 
        self.thisFailsStrictLockCheck()
 
1360
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1334
1361
 
1335
1362
        tree = self.make_branch_and_tree('branch',
1336
 
                                         format=bzrdir.BzrDirFormat6())
 
1363
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1337
1364
 
1338
1365
        # Test all permutations of locking the working tree, branch and repository
1339
1366
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1366
1393
 
1367
1394
Branch history:
1368
1395
         0 revisions
 
1396
         0 committers
1369
1397
 
1370
1398
Repository:
1371
1399
         0 revisions
 
1400
         0 KiB
1372
1401
""" % ('branch', tree.branch.repository._format.get_format_description(),
1373
1402
       ), out)
1374
1403
        self.assertEqual('', err)
1398
1427
 
1399
1428
Branch history:
1400
1429
         0 revisions
 
1430
         0 committers
1401
1431
 
1402
1432
Repository:
1403
1433
         0 revisions
 
1434
         0 KiB
1404
1435
""" % ('branch', tree.branch.repository._format.get_format_description(),
1405
1436
       ), out)
1406
1437
        self.assertEqual('', err)
1407
1438
        tree.unlock()
1408
 
 
1409
 
    def test_info_stacked(self):
1410
 
        # We have a mainline
1411
 
        trunk_tree = self.make_branch_and_tree('mainline',
1412
 
            format='1.6')
1413
 
        trunk_tree.commit('mainline')
1414
 
        # and a branch from it which is stacked
1415
 
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1416
 
        out, err = self.run_bzr('info newbranch')
1417
 
        self.assertEqual(
1418
 
"""Standalone tree (format: 1.6)
1419
 
Location:
1420
 
  branch root: newbranch
1421
 
 
1422
 
Related branches:
1423
 
  parent branch: mainline
1424
 
     stacked on: mainline
1425
 
""", out)
1426
 
        self.assertEqual("", err)