/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 breezy/tests/blackbox/test_info.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from breezy.bzr import (
34
34
    bzrdir,
35
35
    )
36
 
from breezy.tests.matchers import ContainsNoVfsCalls
37
36
from breezy.transport import memory
38
37
 
39
38
 
84
83
                         '  checkout of branch: target\n')
85
84
        self.assertEqual(err, '')
86
85
 
 
86
    def test_info_colocated(self):
 
87
        br = self.make_branch_and_tree('target', format='development-colo')
 
88
        target = br.controldir.create_branch(name='dichtbij')
 
89
        br.controldir.set_branch_reference(target)
 
90
        out, err = self.run_bzr('info target')
 
91
        self.assertEqual(out,
 
92
                         'Standalone tree (format: development-colo)\n'
 
93
                         'Location:\n'
 
94
                         '            light checkout root: target\n'
 
95
                         '  checkout of co-located branch: dichtbij\n')
 
96
        self.assertEqual(err, '')
 
97
 
87
98
    def test_info_standalone(self):
88
99
        transport = self.get_transport()
89
100
 
123
134
         1 added
124
135
         0 removed
125
136
         0 renamed
 
137
         0 copied
126
138
         0 unknown
127
139
         0 ignored
128
140
         0 versioned subdirectories
157
169
         1 added
158
170
         0 removed
159
171
         0 renamed
 
172
         0 copied
160
173
         0 unknown
161
174
         0 ignored
162
175
         0 versioned subdirectories
214
227
         0 added
215
228
         0 removed
216
229
         0 renamed
 
230
         0 copied
217
231
         0 unknown
218
232
         0 ignored
219
233
         0 versioned subdirectories
263
277
         0 added
264
278
         0 removed
265
279
         0 renamed
 
280
         0 copied
266
281
         0 unknown
267
282
         0 ignored
268
283
         0 versioned subdirectories
309
324
         0 added
310
325
         0 removed
311
326
         0 renamed
 
327
         0 copied
312
328
         0 unknown
313
329
         0 ignored
314
330
         0 versioned subdirectories
355
371
         0 added
356
372
         0 removed
357
373
         0 renamed
 
374
         0 copied
358
375
         0 unknown
359
376
         0 ignored
360
377
         0 versioned subdirectories
403
420
         0 added
404
421
         0 removed
405
422
         0 renamed
 
423
         0 copied
406
424
         0 unknown
407
425
         0 ignored
408
426
         0 versioned subdirectories
447
465
         0 added
448
466
         0 removed
449
467
         0 renamed
 
468
         0 copied
450
469
         0 unknown
451
470
         0 ignored
452
471
         0 versioned subdirectories
489
508
         0 added
490
509
         0 removed
491
510
         0 renamed
 
511
         0 copied
492
512
         0 unknown
493
513
         0 ignored
494
514
         0 versioned subdirectories
531
551
         0 added
532
552
         0 removed
533
553
         0 renamed
 
554
         0 copied
534
555
         0 unknown
535
556
         0 ignored
536
557
         0 versioned subdirectories
674
695
         0 added
675
696
         0 removed
676
697
         0 renamed
 
698
         0 copied
677
699
         0 unknown
678
700
         0 ignored
679
701
         0 versioned subdirectories
717
739
         0 added
718
740
         0 removed
719
741
         0 renamed
 
742
         0 copied
720
743
         0 unknown
721
744
         0 ignored
722
745
         0 versioned subdirectories
757
780
         1 added
758
781
         0 removed
759
782
         0 renamed
 
783
         0 copied
760
784
         0 unknown
761
785
         0 ignored
762
786
         0 versioned subdirectories
804
828
         0 added
805
829
         0 removed
806
830
         0 renamed
 
831
         0 copied
807
832
         0 unknown
808
833
         0 ignored
809
834
         0 versioned subdirectories
929
954
         0 added
930
955
         0 removed
931
956
         0 renamed
 
957
         0 copied
932
958
         0 unknown
933
959
         0 ignored
934
960
         0 versioned subdirectories
972
998
         0 added
973
999
         0 removed
974
1000
         0 renamed
 
1001
         0 copied
975
1002
         0 unknown
976
1003
         0 ignored
977
1004
         0 versioned subdirectories
1016
1043
         0 added
1017
1044
         0 removed
1018
1045
         0 renamed
 
1046
         0 copied
1019
1047
         0 unknown
1020
1048
         0 ignored
1021
1049
         0 versioned subdirectories
1058
1086
         0 added
1059
1087
         0 removed
1060
1088
         0 renamed
 
1089
         0 copied
1061
1090
         0 unknown
1062
1091
         0 ignored
1063
1092
         0 versioned subdirectories
1153
1182
         0 added
1154
1183
         0 removed
1155
1184
         0 renamed
 
1185
         0 copied
1156
1186
         0 unknown
1157
1187
         0 ignored
1158
1188
         0 versioned subdirectories
1336
1366
         0 added
1337
1367
         0 removed
1338
1368
         0 renamed
 
1369
         0 copied
1339
1370
         0 unknown
1340
1371
         0 ignored
1341
1372
         0 versioned subdirectories
1387
1418
                                        repo_branch=repo_branch,
1388
1419
                                        verbose=True, light_checkout=True)
1389
1420
        # U U L
1390
 
        lco_tree.branch.repository.lock_write()
1391
 
        try:
 
1421
        with lco_tree.branch.repository.lock_write():
1392
1422
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1393
1423
                                            lco_tree, repo_branch=repo_branch,
1394
1424
                                            repo_locked=True, verbose=True, light_checkout=True)
1395
 
        finally:
1396
 
            lco_tree.branch.repository.unlock()
1397
1425
        # U L L
1398
 
        lco_tree.branch.lock_write()
1399
 
        try:
 
1426
        with lco_tree.branch.lock_write():
1400
1427
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1401
1428
                                            lco_tree,
1402
1429
                                            branch_locked=True,
1403
1430
                                            repo_locked=True,
1404
1431
                                            repo_branch=repo_branch,
1405
1432
                                            verbose=True)
1406
 
        finally:
1407
 
            lco_tree.branch.unlock()
1408
1433
        # L L L
1409
 
        lco_tree.lock_write()
1410
 
        try:
 
1434
        with lco_tree.lock_write():
1411
1435
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1412
1436
                                            lco_tree, repo_branch=repo_branch,
1413
1437
                                            tree_locked=True,
1414
1438
                                            branch_locked=True,
1415
1439
                                            repo_locked=True,
1416
1440
                                            verbose=True)
1417
 
        finally:
1418
 
            lco_tree.unlock()
1419
1441
        # L L U
1420
 
        lco_tree.lock_write()
1421
 
        lco_tree.branch.repository.unlock()
1422
 
        try:
 
1442
        with lco_tree.lock_write(), lco_tree.branch.repository.unlock():
1423
1443
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1424
1444
                                            lco_tree, repo_branch=repo_branch,
1425
1445
                                            tree_locked=True,
1426
1446
                                            branch_locked=True,
1427
1447
                                            verbose=True)
1428
 
        finally:
1429
 
            lco_tree.branch.repository.lock_write()
1430
 
            lco_tree.unlock()
1431
1448
        # L U U
1432
 
        lco_tree.lock_write()
1433
 
        lco_tree.branch.unlock()
1434
 
        try:
 
1449
        with lco_tree.lock_write(), lco_tree.branch.unlock():
1435
1450
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1436
1451
                                            lco_tree, repo_branch=repo_branch,
1437
1452
                                            tree_locked=True,
1438
1453
                                            verbose=True)
1439
 
        finally:
1440
 
            lco_tree.branch.lock_write()
1441
 
            lco_tree.unlock()
1442
1454
        # L U L
1443
 
        lco_tree.lock_write()
1444
 
        lco_tree.branch.unlock()
1445
 
        lco_tree.branch.repository.lock_write()
1446
 
        try:
 
1455
        with lco_tree.lock_write(), lco_tree.branch.unlock(), \
 
1456
                lco_tree.branch.repository.lock_write():
1447
1457
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1448
1458
                                            lco_tree, repo_branch=repo_branch,
1449
1459
                                            tree_locked=True,
1450
1460
                                            repo_locked=True,
1451
1461
                                            verbose=True)
1452
 
        finally:
1453
 
            lco_tree.branch.repository.unlock()
1454
 
            lco_tree.branch.lock_write()
1455
 
            lco_tree.unlock()
1456
1462
        # U L U
1457
 
        lco_tree.branch.lock_write()
1458
 
        lco_tree.branch.repository.unlock()
1459
 
        try:
 
1463
        with lco_tree.branch.lock_write(), lco_tree.branch.repository.unlock():
1460
1464
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1461
1465
                                            lco_tree, repo_branch=repo_branch,
1462
1466
                                            branch_locked=True,
1463
1467
                                            verbose=True)
1464
 
        finally:
1465
 
            lco_tree.branch.repository.lock_write()
1466
 
            lco_tree.branch.unlock()
1467
1468
 
1468
1469
        if sys.platform == 'win32':
1469
1470
            self.knownFailure('Win32 cannot run "brz info"'
1516
1517
         0 added
1517
1518
         0 removed
1518
1519
         0 renamed
 
1520
         0 copied
1519
1521
         0 unknown
1520
1522
         0 ignored
1521
1523
         0 versioned subdirectories
1548
1550
         0 revisions
1549
1551
""", out)
1550
1552
        self.assertEqual("", err)
1551
 
 
1552
 
 
1553
 
class TestSmartServerInfo(tests.TestCaseWithTransport):
1554
 
 
1555
 
    def test_simple_branch_info(self):
1556
 
        self.setup_smart_server_with_call_log()
1557
 
        t = self.make_branch_and_tree('branch')
1558
 
        self.build_tree_contents([('branch/foo', b'thecontents')])
1559
 
        t.add("foo")
1560
 
        t.commit("message")
1561
 
        self.reset_smart_call_log()
1562
 
        out, err = self.run_bzr(['info', self.get_url('branch')])
1563
 
        # This figure represent the amount of work to perform this use case. It
1564
 
        # is entirely ok to reduce this number if a test fails due to rpc_count
1565
 
        # being too low. If rpc_count increases, more network roundtrips have
1566
 
        # become necessary for this use case. Please do not adjust this number
1567
 
        # upwards without agreement from bzr's network support maintainers.
1568
 
        self.assertLength(10, self.hpss_calls)
1569
 
        self.assertLength(1, self.hpss_connections)
1570
 
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1571
 
 
1572
 
    def test_verbose_branch_info(self):
1573
 
        self.setup_smart_server_with_call_log()
1574
 
        t = self.make_branch_and_tree('branch')
1575
 
        self.build_tree_contents([('branch/foo', b'thecontents')])
1576
 
        t.add("foo")
1577
 
        t.commit("message")
1578
 
        self.reset_smart_call_log()
1579
 
        out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
1580
 
        # This figure represent the amount of work to perform this use case. It
1581
 
        # is entirely ok to reduce this number if a test fails due to rpc_count
1582
 
        # being too low. If rpc_count increases, more network roundtrips have
1583
 
        # become necessary for this use case. Please do not adjust this number
1584
 
        # upwards without agreement from bzr's network support maintainers.
1585
 
        self.assertLength(14, self.hpss_calls)
1586
 
        self.assertLength(1, self.hpss_connections)
1587
 
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)