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

use executemany when inserting sha map entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
    def commit(self):
161
161
        self.db.commit()
162
162
 
 
163
    def add_entries(self, entries):
 
164
        trees = []
 
165
        blobs = []
 
166
        for sha, type, type_data in entries:
 
167
            if type == "tree":
 
168
                trees.append((sha, type_data[0], type_data[1]))
 
169
            elif type == "blob":
 
170
                blobs.append((sha, type_data[0], type_data[1]))
 
171
            else:
 
172
                raise AssertionError
 
173
        if trees:
 
174
            self.db.executemany("replace into trees (sha1, fileid, revid) values (?, ?, ?)", trees)
 
175
        if blobs:
 
176
            self.db.executemany("replace into blobs (sha1, fileid, revid) values (?, ?, ?)", blobs)
 
177
 
 
178
 
163
179
    def add_entry(self, sha, type, type_data):
164
180
        """Add a new entry to the database.
165
181
        """