##// END OF EJS Templates
bundle: move chunk parsing into unbundle class
Matt Mackall -
r12336:9d234f7d default
parent child Browse files
Show More
@@ -163,6 +163,15 b' class unbundle10(object):'
163 % (len(d), l))
163 % (len(d), l))
164 return d
164 return d
165
165
166 def parsechunk(self):
167 l = self.chunklength()
168 if not l:
169 return {}
170 h = self.read(80)
171 node, p1, p2, cs = struct.unpack("20s20s20s20s", h)
172 data = self.read(l - 80)
173 return dict(node=node, p1=p1, p2=p2, cs=cs, data=data)
174
166 class headerlessfixup(object):
175 class headerlessfixup(object):
167 def __init__(self, fh, h):
176 def __init__(self, fh, h):
168 self._h = h
177 self._h = h
@@ -1302,18 +1302,21 b' class revlog(object):'
1302 # loop through our set of deltas
1302 # loop through our set of deltas
1303 chain = None
1303 chain = None
1304 while 1:
1304 while 1:
1305 chunk = bundle.chunk()
1305 chunkdata = bundle.parsechunk()
1306 if not chunk:
1306 if not chunkdata:
1307 break
1307 break
1308 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
1308 node = chunkdata['node']
1309 p1 = chunkdata['p1']
1310 p2 = chunkdata['p2']
1311 cs = chunkdata['cs']
1312 delta = chunkdata['data']
1313
1309 link = linkmapper(cs)
1314 link = linkmapper(cs)
1310 if (node in self.nodemap and
1315 if (node in self.nodemap and
1311 (not self.flags(self.rev(node)) & REVIDX_PUNCHED_FLAG)):
1316 (not self.flags(self.rev(node)) & REVIDX_PUNCHED_FLAG)):
1312 # this can happen if two branches make the same change
1317 # this can happen if two branches make the same change
1313 chain = node
1318 chain = node
1314 continue
1319 continue
1315 delta = buffer(chunk, 80)
1316 del chunk
1317
1320
1318 for p in (p1, p2):
1321 for p in (p1, p2):
1319 if not p in self.nodemap:
1322 if not p in self.nodemap:
General Comments 0
You need to be logged in to leave comments. Login now