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

Avoid interpreting bzr-svn revisions in git revspecs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    TestCaseInTempDir,
41
41
    UnavailableFeature,
42
42
    )
43
 
from bzrlib.transport import (
44
 
    get_transport,
45
 
    )
46
43
 
47
 
from bzrlib.plugins.git.cache import (
 
44
from bzrlib.plugins.git.shamap import (
 
45
    SqliteBzrGitCache,
48
46
    DictBzrGitCache,
49
 
    IndexBzrGitCache,
50
 
    IndexGitCacheFormat,
51
 
    SqliteBzrGitCache,
52
47
    TdbBzrGitCache,
53
48
    )
54
49
 
70
65
        self.map.start_write_group()
71
66
        updater = self.cache.get_updater(Revision("myrevid"))
72
67
        c = self._get_test_commit()
73
 
        updater.add_object(c, {
74
 
            "testament3-sha1": "cc9462f7f8263ef5adf8eff2fb936bb36b504cba"},
75
 
            None)
 
68
        updater.add_object(c, None)
76
69
        updater.finish()
77
70
        self.map.commit_write_group()
78
71
        self.assertEquals(
79
 
            ("commit", ("myrevid",
80
 
                "cc9462f7f8263ef5adfbeff2fb936bb36b504cba",
81
 
                {"testament3-sha1": "cc9462f7f8263ef5adf8eff2fb936bb36b504cba"},
82
 
                )),
 
72
            ("commit", ("myrevid", "cc9462f7f8263ef5adfbeff2fb936bb36b504cba")),
83
73
            self.map.lookup_git_sha(c.id))
84
74
        self.assertEquals(c.id, self.map.lookup_commit("myrevid"))
85
75
 
90
80
    def test_blob(self):
91
81
        self.map.start_write_group()
92
82
        updater = self.cache.get_updater(Revision("myrevid"))
93
 
        updater.add_object(self._get_test_commit(), { "testament3-sha1": "Test" }, None)
 
83
        updater.add_object(self._get_test_commit(), None)
94
84
        b = Blob()
95
85
        b.data = "TEH BLOB"
96
86
        ie = InventoryFile("myfileid", "somename", ROOT_ID)
97
87
        ie.revision = "myrevid"
98
 
        updater.add_object(b, ie, None)
 
88
        updater.add_object(b, ie)
99
89
        updater.finish()
100
90
        self.map.commit_write_group()
101
91
        self.assertEquals(
107
97
    def test_tree(self):
108
98
        self.map.start_write_group()
109
99
        updater = self.cache.get_updater(Revision("myrevid"))
110
 
        updater.add_object(self._get_test_commit(), {
111
 
            "testament3-sha1": "mytestamentsha" }, None)
 
100
        updater.add_object(self._get_test_commit(), None)
112
101
        t = Tree()
113
102
        t.add(stat.S_IFREG, "somename", Blob().id)
114
103
        ie = InventoryDirectory("fileid", "myname", ROOT_ID)
115
104
        ie.revision = "irrelevant"
116
 
        updater.add_object(t, ie, "")
 
105
        updater.add_object(t, ie)
117
106
        updater.finish()
118
107
        self.map.commit_write_group()
119
108
        self.assertEquals(("tree", ("fileid", "myrevid")),
129
118
        self.map.start_write_group()
130
119
        updater = self.cache.get_updater(Revision("myrevid"))
131
120
        c = self._get_test_commit()
132
 
        updater.add_object(c, {"testament3-sha1": "mtestament"}, None)
 
121
        updater.add_object(c, None)
133
122
        updater.finish()
134
123
        self.map.commit_write_group()
135
124
        self.assertEquals(["myrevid"], list(self.map.revids()))
138
127
        self.map.start_write_group()
139
128
        updater = self.cache.get_updater(Revision("myrevid"))
140
129
        c = self._get_test_commit()
141
 
        updater.add_object(c, {"testament3-sha1": "testament"}, None)
 
130
        updater.add_object(c, None)
142
131
        updater.finish()
143
132
        self.map.commit_write_group()
144
133
        self.assertEquals(set(["lala", "bla"]),
170
159
        except ImportError:
171
160
            raise UnavailableFeature("Missing tdb")
172
161
        self.map = self.cache.idmap
173
 
 
174
 
 
175
 
class IndexGitShaMapTests(TestCaseInTempDir,TestGitShaMap):
176
 
 
177
 
    def setUp(self):
178
 
        TestCaseInTempDir.setUp(self)
179
 
        transport = get_transport(self.test_dir)
180
 
        IndexGitCacheFormat().initialize(transport)
181
 
        self.cache = IndexBzrGitCache(transport)
182
 
        self.map = self.cache.idmap