Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 5367:7530334bf301
revlog: generate trivial deltas against null revision
To avoid extra memory usage and performance issues with large files,
generate a trivial delta header for deltas against the null revision
rather than calling the usual delta generator.
We append the delta header to meta rather than prepending it to data
to avoid a large allocate and copy.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 03 Oct 2007 17:17:27 -0500 |
parents | f87685355c9c |
children | 61462e7d62ed |
comparison
equal
deleted
inserted
replaced
5366:ff32b2725651 | 5367:7530334bf301 |
---|---|
1085 nb = self.node(b) | 1085 nb = self.node(b) |
1086 | 1086 |
1087 if infocollect is not None: | 1087 if infocollect is not None: |
1088 infocollect(nb) | 1088 infocollect(nb) |
1089 | 1089 |
1090 d = self.revdiff(a, b) | |
1091 p = self.parents(nb) | 1090 p = self.parents(nb) |
1092 meta = nb + p[0] + p[1] + lookup(nb) | 1091 meta = nb + p[0] + p[1] + lookup(nb) |
1092 if a == -1: | |
1093 d = self.revision(nb) | |
1094 meta += mdiff.trivialdiffheader(len(d)) | |
1095 else: | |
1096 d = self.revdiff(a, b) | |
1093 yield changegroup.genchunk("%s%s" % (meta, d)) | 1097 yield changegroup.genchunk("%s%s" % (meta, d)) |
1094 | 1098 |
1095 yield changegroup.closechunk() | 1099 yield changegroup.closechunk() |
1096 | 1100 |
1097 def addgroup(self, revs, linkmapper, transaction, unique=0): | 1101 def addgroup(self, revs, linkmapper, transaction, unique=0): |