/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

Add 'github:' directory service.

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