Mercurial > hgsubversion
changeset 1412:7e98352a37db
maps: add the "batchset" method to RevMap
This is a part of the bigger plan to get rid of reading or writing rev_map
directly without going through the RevMap class.
The "batchset" method is like "__setitem__" but set items in batches. It
will be used in rebuildmeta.
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 09 May 2016 21:11:00 +0100 |
parents | 025e849d22f0 |
children | 951a87f2f2bd |
files | hgsubversion/maps.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/maps.py +++ b/hgsubversion/maps.py @@ -360,6 +360,19 @@ class RevMap(dict): dict.clear(self) self._hashes = None + def batchset(self, items): + '''Set items in batches + + items is an array of (rev num, branch, binary hash) + + For performance reason, meta.lastpulled and meta.firstpulled + are not updated. + ''' + f = open(self.meta.revmap_file, 'a') + f.write(''.join('%s %s %s\n' % (revnum, hex(binhash), br or '') + for revnum, br, binhash in items)) + f.close() + @classmethod def readmapfile(cls, path, missingok=True): try: