1212 """lists the contents of a bundle""" |
1212 """lists the contents of a bundle""" |
1213 f = url.open(ui, bundlepath) |
1213 f = url.open(ui, bundlepath) |
1214 try: |
1214 try: |
1215 gen = changegroup.readbundle(f, bundlepath) |
1215 gen = changegroup.readbundle(f, bundlepath) |
1216 if all: |
1216 if all: |
1217 ui.write("format: id, p1, p2, cset, len(delta)\n") |
1217 ui.write("format: id, p1, p2, cset, delta base, len(delta)\n") |
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 while 1: |
1222 while 1: |
1222 chunkdata = gen.parsechunk() |
1223 chunkdata = gen.parsechunk(chain) |
1223 if not chunkdata: |
1224 if not chunkdata: |
1224 break |
1225 break |
1225 node = chunkdata['node'] |
1226 node = chunkdata['node'] |
1226 p1 = chunkdata['p1'] |
1227 p1 = chunkdata['p1'] |
1227 p2 = chunkdata['p2'] |
1228 p2 = chunkdata['p2'] |
1228 cs = chunkdata['cs'] |
1229 cs = chunkdata['cs'] |
1229 delta = chunkdata['data'] |
1230 deltabase = chunkdata['deltabase'] |
1230 ui.write("%s %s %s %s %s\n" % |
1231 delta = chunkdata['delta'] |
|
1232 ui.write("%s %s %s %s %s %s\n" % |
1231 (hex(node), hex(p1), hex(p2), |
1233 (hex(node), hex(p1), hex(p2), |
1232 hex(cs), len(delta))) |
1234 hex(cs), hex(deltabase), len(delta))) |
|
1235 chain = node |
1233 |
1236 |
1234 showchunks("changelog") |
1237 showchunks("changelog") |
1235 showchunks("manifest") |
1238 showchunks("manifest") |
1236 while 1: |
1239 while 1: |
1237 fname = gen.chunk() |
1240 fname = gen.chunk() |
1238 if not fname: |
1241 if not fname: |
1239 break |
1242 break |
1240 showchunks(fname) |
1243 showchunks(fname) |
1241 else: |
1244 else: |
|
1245 chain = None |
1242 while 1: |
1246 while 1: |
1243 chunkdata = gen.parsechunk() |
1247 chunkdata = gen.parsechunk(chain) |
1244 if not chunkdata: |
1248 if not chunkdata: |
1245 break |
1249 break |
1246 node = chunkdata['node'] |
1250 node = chunkdata['node'] |
1247 ui.write("%s\n" % hex(node)) |
1251 ui.write("%s\n" % hex(node)) |
|
1252 chain = node |
1248 finally: |
1253 finally: |
1249 f.close() |
1254 f.close() |
1250 |
1255 |
1251 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
1256 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
1252 """retrieves a bundle from a repo |
1257 """retrieves a bundle from a repo |