comparison mercurial/commands.py @ 14144:3c3c53d8343a

unbundler: separate delta and header parsing Add header parsing for changelog and manifest (currently no headers might change for next-gen bundle).
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 30 Apr 2011 19:01:24 +0200
parents bd1cbfe5db5c
children a8f136f430da
comparison
equal deleted inserted replaced
14143:da635d3c5620 14144:3c3c53d8343a
1218 1218
1219 def showchunks(named): 1219 def showchunks(named):
1220 ui.write("\n%s\n" % named) 1220 ui.write("\n%s\n" % named)
1221 chain = None 1221 chain = None
1222 while 1: 1222 while 1:
1223 chunkdata = gen.parsechunk(chain) 1223 chunkdata = gen.deltachunk(chain)
1224 if not chunkdata: 1224 if not chunkdata:
1225 break 1225 break
1226 node = chunkdata['node'] 1226 node = chunkdata['node']
1227 p1 = chunkdata['p1'] 1227 p1 = chunkdata['p1']
1228 p2 = chunkdata['p2'] 1228 p2 = chunkdata['p2']
1232 ui.write("%s %s %s %s %s %s\n" % 1232 ui.write("%s %s %s %s %s %s\n" %
1233 (hex(node), hex(p1), hex(p2), 1233 (hex(node), hex(p1), hex(p2),
1234 hex(cs), hex(deltabase), len(delta))) 1234 hex(cs), hex(deltabase), len(delta)))
1235 chain = node 1235 chain = node
1236 1236
1237 chunkdata = gen.changelogheader()
1237 showchunks("changelog") 1238 showchunks("changelog")
1239 chunkdata = gen.manifestheader()
1238 showchunks("manifest") 1240 showchunks("manifest")
1239 while 1: 1241 while 1:
1240 fname = gen.chunk() 1242 chunkdata = gen.filelogheader()
1241 if not fname: 1243 if not chunkdata:
1242 break 1244 break
1245 fname = chunkdata['filename']
1243 showchunks(fname) 1246 showchunks(fname)
1244 else: 1247 else:
1248 chunkdata = gen.changelogheader()
1245 chain = None 1249 chain = None
1246 while 1: 1250 while 1:
1247 chunkdata = gen.parsechunk(chain) 1251 chunkdata = gen.deltachunk(chain)
1248 if not chunkdata: 1252 if not chunkdata:
1249 break 1253 break
1250 node = chunkdata['node'] 1254 node = chunkdata['node']
1251 ui.write("%s\n" % hex(node)) 1255 ui.write("%s\n" % hex(node))
1252 chain = node 1256 chain = node