Show More
@@ -6,7 +6,8 b'' | |||
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | import util | |
|
9 | from node import nullrev | |
|
10 | import mdiff, util | |
|
10 | 11 | import struct, os, bz2, zlib, tempfile |
|
11 | 12 | |
|
12 | 13 | _BUNDLE10_DELTA_HEADER = "20s20s20s20s" |
@@ -212,16 +213,33 b' def readbundle(fh, fname):' | |||
|
212 | 213 | return unbundle10(fh, alg) |
|
213 | 214 | |
|
214 | 215 | class bundle10(object): |
|
216 | deltaheader = _BUNDLE10_DELTA_HEADER | |
|
215 | 217 | def __init__(self, lookup): |
|
216 | 218 | self._lookup = lookup |
|
217 | 219 | def close(self): |
|
218 | 220 | return closechunk() |
|
219 | 221 | def fileheader(self, fname): |
|
220 | 222 | return chunkheader(len(fname)) + fname |
|
221 |
def revchunk(self, revlog, |
|
|
223 | def revchunk(self, revlog, rev, prev): | |
|
224 | node = revlog.node(rev) | |
|
225 | p1, p2 = revlog.parentrevs(rev) | |
|
226 | base = prev | |
|
227 | ||
|
228 | prefix = '' | |
|
229 | if base == nullrev: | |
|
230 | delta = revlog.revision(node) | |
|
231 | prefix = mdiff.trivialdiffheader(len(delta)) | |
|
232 | else: | |
|
233 | delta = revlog.revdiff(base, rev) | |
|
222 | 234 | linknode = self._lookup(revlog, node) |
|
223 | meta = node + p1 + p2 + linknode + prefix | |
|
224 | l = len(meta) + len(data) | |
|
235 | p1n, p2n = revlog.parents(node) | |
|
236 | basenode = revlog.node(base) | |
|
237 | meta = self.builddeltaheader(node, p1n, p2n, basenode, linknode) | |
|
238 | meta += prefix | |
|
239 | l = len(meta) + len(delta) | |
|
225 | 240 | yield chunkheader(l) |
|
226 | 241 | yield meta |
|
227 |
yield d |
|
|
242 | yield delta | |
|
243 | def builddeltaheader(self, node, p1n, p2n, basenode, linknode): | |
|
244 | # do nothing with basenode, it is implicitly the previous one in HG10 | |
|
245 | return struct.pack(self.deltaheader, node, p1n, p2n, linknode) |
@@ -1086,17 +1086,8 b' class revlog(object):' | |||
|
1086 | 1086 | |
|
1087 | 1087 | # build deltas |
|
1088 | 1088 | for r in xrange(len(revs) - 1): |
|
1089 |
|
|
|
1090 | nb = self.node(b) | |
|
1091 | p1, p2 = self.parents(nb) | |
|
1092 | prefix = '' | |
|
1093 | ||
|
1094 | if a == nullrev: | |
|
1095 | d = self.revision(nb) | |
|
1096 | prefix = mdiff.trivialdiffheader(len(d)) | |
|
1097 | else: | |
|
1098 | d = self.revdiff(a, b) | |
|
1099 | for c in bundler.revchunk(self, nb, p1, p2, prefix, d): | |
|
1089 | prev, curr = revs[r], revs[r + 1] | |
|
1090 | for c in bundler.revchunk(self, curr, prev): | |
|
1100 | 1091 | yield c |
|
1101 | 1092 | |
|
1102 | 1093 | yield bundler.close() |
General Comments 0
You need to be logged in to leave comments.
Login now