/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/test_bundle.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import SocketServer
20
20
import sys
21
21
 
22
 
from brzlib import (
 
22
from breezy import (
23
23
    bzrdir,
24
24
    diff,
25
25
    errors,
30
30
    tests,
31
31
    treebuilder,
32
32
    )
33
 
from brzlib.bundle import read_mergeable_from_url
34
 
from brzlib.bundle.apply_bundle import install_bundle, merge_bundle
35
 
from brzlib.bundle.bundle_data import BundleTree
36
 
from brzlib.directory_service import directories
37
 
from brzlib.bundle.serializer import write_bundle, read_bundle, v09, v4
38
 
from brzlib.bundle.serializer.v08 import BundleSerializerV08
39
 
from brzlib.bundle.serializer.v09 import BundleSerializerV09
40
 
from brzlib.bundle.serializer.v4 import BundleSerializerV4
41
 
from brzlib.repofmt import knitrepo
42
 
from brzlib.tests import (
 
33
from breezy.bundle import read_mergeable_from_url
 
34
from breezy.bundle.apply_bundle import install_bundle, merge_bundle
 
35
from breezy.bundle.bundle_data import BundleTree
 
36
from breezy.directory_service import directories
 
37
from breezy.bundle.serializer import write_bundle, read_bundle, v09, v4
 
38
from breezy.bundle.serializer.v08 import BundleSerializerV08
 
39
from breezy.bundle.serializer.v09 import BundleSerializerV09
 
40
from breezy.bundle.serializer.v4 import BundleSerializerV4
 
41
from breezy.repofmt import knitrepo
 
42
from breezy.tests import (
43
43
    features,
44
44
    test_commit,
45
45
    test_read_bundle,
46
46
    test_server,
47
47
    )
48
 
from brzlib.transform import TreeTransform
 
48
from breezy.transform import TreeTransform
49
49
 
50
50
 
51
51
def get_text(vf, key):
67
67
class MockTree(object):
68
68
 
69
69
    def __init__(self):
70
 
        from brzlib.inventory import InventoryDirectory, ROOT_ID
 
70
        from breezy.inventory import InventoryDirectory, ROOT_ID
71
71
        object.__init__(self)
72
72
        self.paths = {ROOT_ID: ""}
73
73
        self.ids = {"": ROOT_ID}
111
111
        return kind
112
112
 
113
113
    def make_entry(self, file_id, path):
114
 
        from brzlib.inventory import (InventoryFile , InventoryDirectory,
 
114
        from breezy.inventory import (InventoryFile , InventoryDirectory,
115
115
            InventoryLink)
116
116
        name = os.path.basename(path)
117
117
        kind = self.kind(file_id)
1347
1347
 
1348
1348
        :return: The in-memory bundle
1349
1349
        """
1350
 
        from brzlib.bundle import serializer
 
1350
        from breezy.bundle import serializer
1351
1351
        bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id)
1352
1352
        new_text = self.get_raw(StringIO(''.join(bundle_txt)))
1353
1353
        new_text = new_text.replace('<file file_id="exe-1"',
1422
1422
 
1423
1423
    def test_copy_signatures(self):
1424
1424
        tree_a = self.make_branch_and_tree('tree_a')
1425
 
        import brzlib.gpg
1426
 
        import brzlib.commit as commit
1427
 
        oldstrategy = brzlib.gpg.GPGStrategy
 
1425
        import breezy.gpg
 
1426
        import breezy.commit as commit
 
1427
        oldstrategy = breezy.gpg.GPGStrategy
1428
1428
        branch = tree_a.branch
1429
1429
        repo_a = branch.repository
1430
1430
        tree_a.commit("base", allow_pointless=True, rev_id='A')
1431
1431
        self.assertFalse(branch.repository.has_signature_for_revision_id('A'))
1432
1432
        try:
1433
 
            from brzlib.testament import Testament
 
1433
            from breezy.testament import Testament
1434
1434
            # monkey patch gpg signing mechanism
1435
 
            brzlib.gpg.GPGStrategy = brzlib.gpg.LoopbackGPGStrategy
 
1435
            breezy.gpg.GPGStrategy = breezy.gpg.LoopbackGPGStrategy
1436
1436
            new_config = test_commit.MustSignConfig()
1437
1437
            commit.Commit(config_stack=new_config).commit(message="base",
1438
1438
                                                    allow_pointless=True,
1439
1439
                                                    rev_id='B',
1440
1440
                                                    working_tree=tree_a)
1441
1441
            def sign(text):
1442
 
                return brzlib.gpg.LoopbackGPGStrategy(None).sign(text)
 
1442
                return breezy.gpg.LoopbackGPGStrategy(None).sign(text)
1443
1443
            self.assertTrue(repo_a.has_signature_for_revision_id('B'))
1444
1444
        finally:
1445
 
            brzlib.gpg.GPGStrategy = oldstrategy
 
1445
            breezy.gpg.GPGStrategy = oldstrategy
1446
1446
        tree_b = self.make_branch_and_tree('tree_b')
1447
1447
        repo_b = tree_b.branch.repository
1448
1448
        s = StringIO()
1469
1469
 
1470
1470
        :return: The in-memory bundle
1471
1471
        """
1472
 
        from brzlib.bundle import serializer
 
1472
        from breezy.bundle import serializer
1473
1473
        bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id)
1474
1474
        new_text = self.get_raw(StringIO(''.join(bundle_txt)))
1475
1475
        # We are going to be replacing some text to set the executable bit on a
1838
1838
    def test_infinite_redirects_are_not_a_bundle(self):
1839
1839
        """If a URL causes TooManyRedirections then NotABundle is raised.
1840
1840
        """
1841
 
        from brzlib.tests.blackbox.test_push import RedirectingMemoryServer
 
1841
        from breezy.tests.blackbox.test_push import RedirectingMemoryServer
1842
1842
        server = RedirectingMemoryServer()
1843
1843
        self.start_server(server)
1844
1844
        url = server.get_url() + 'infinite-loop'