/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 tests/test_cache.py

More work on roundtrip push support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import os
26
26
import stat
27
27
 
28
 
from bzrlib import osutils
29
 
 
30
28
from bzrlib.inventory import (
31
29
    InventoryFile,
32
30
    InventoryDirectory,
78
76
        updater.finish()
79
77
        self.map.commit_write_group()
80
78
        self.assertEquals(
81
 
            [("commit", ("myrevid",
 
79
            ("commit", ("myrevid",
82
80
                "cc9462f7f8263ef5adfbeff2fb936bb36b504cba",
83
81
                {"testament3-sha1": "cc9462f7f8263ef5adf8eff2fb936bb36b504cba"},
84
 
                ))],
85
 
            list(self.map.lookup_git_sha(c.id)))
 
82
                )),
 
83
            self.map.lookup_git_sha(c.id))
86
84
        self.assertEquals(c.id, self.map.lookup_commit("myrevid"))
87
85
 
88
86
    def test_lookup_notfound(self):
89
 
        self.assertRaises(KeyError, list,
90
 
            self.map.lookup_git_sha("5686645d49063c73d35436192dfc9a160c672301"))
 
87
        self.assertRaises(KeyError,
 
88
            self.map.lookup_git_sha, "5686645d49063c73d35436192dfc9a160c672301")
91
89
 
92
90
    def test_blob(self):
93
91
        self.map.start_write_group()
101
99
        updater.finish()
102
100
        self.map.commit_write_group()
103
101
        self.assertEquals(
104
 
            [("blob", ("myfileid", "myrevid"))],
105
 
            list(self.map.lookup_git_sha(b.id)))
 
102
            ("blob", ("myfileid", "myrevid")),
 
103
            self.map.lookup_git_sha(b.id))
106
104
        self.assertEquals(b.id,
107
105
            self.map.lookup_blob_id("myfileid", "myrevid"))
108
106
 
112
110
        updater.add_object(self._get_test_commit(), {
113
111
            "testament3-sha1": "mytestamentsha" }, None)
114
112
        t = Tree()
115
 
        t.add("somename", stat.S_IFREG, Blob().id)
 
113
        t.add(stat.S_IFREG, "somename", Blob().id)
116
114
        ie = InventoryDirectory("fileid", "myname", ROOT_ID)
117
115
        ie.revision = "irrelevant"
118
116
        updater.add_object(t, ie, "")
119
117
        updater.finish()
120
118
        self.map.commit_write_group()
121
 
        self.assertEquals([("tree", ("fileid", "myrevid"))],
122
 
            list(self.map.lookup_git_sha(t.id)))
 
119
        self.assertEquals(("tree", ("fileid", "myrevid")),
 
120
            self.map.lookup_git_sha(t.id))
123
121
        # It's possible for a backend to not implement lookup_tree
124
122
        try:
125
123
            self.assertEquals(t.id,
168
166
    def setUp(self):
169
167
        TestCaseInTempDir.setUp(self)
170
168
        try:
171
 
            self.cache = TdbBzrGitCache(
172
 
                os.path.join(self.test_dir, 'foo.tdb').encode(osutils._fs_enc))
 
169
            self.cache = TdbBzrGitCache(os.path.join(self.test_dir, 'foo.tdb'))
173
170
        except ImportError:
174
171
            raise UnavailableFeature("Missing tdb")
175
172
        self.map = self.cache.idmap