##// END OF EJS Templates
debugindex: add --format flag to allow debugging parentdelta...
Matt Mackall -
r12893:15ca4bfe stable
parent child Browse files
Show More
@@ -1260,26 +1260,43 b' def debugdate(ui, date, range=None, **op'
1260 1260 m = util.matchdate(range)
1261 1261 ui.write("match: %s\n" % m(d[0]))
1262 1262
1263 def debugindex(ui, repo, file_):
1263 def debugindex(ui, repo, file_, **opts):
1264 1264 """dump the contents of an index file"""
1265 1265 r = None
1266 1266 if repo:
1267 1267 filelog = repo.file(file_)
1268 1268 if len(filelog):
1269 1269 r = filelog
1270
1271 format = opts.get('format', 0)
1272 if format not in (0, 1):
1273 raise util.abort("unknown format %d" % format)
1274
1270 1275 if not r:
1271 1276 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
1272 ui.write(" rev offset length base linkrev"
1273 " nodeid p1 p2\n")
1277
1278 if format == 0:
1279 ui.write(" rev offset length base linkrev"
1280 " nodeid p1 p2\n")
1281 elif format == 1:
1282 ui.write(" rev flag offset length"
1283 " size base link p1 p2 nodeid\n")
1284
1274 1285 for i in r:
1275 1286 node = r.node(i)
1276 try:
1277 pp = r.parents(node)
1278 except:
1279 pp = [nullid, nullid]
1280 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1281 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
1282 short(node), short(pp[0]), short(pp[1])))
1287 if format == 0:
1288 try:
1289 pp = r.parents(node)
1290 except:
1291 pp = [nullid, nullid]
1292 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1293 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
1294 short(node), short(pp[0]), short(pp[1])))
1295 elif format == 1:
1296 pr = r.parentrevs(i)
1297 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
1298 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1299 r.base(i), r.linkrev(i), pr[0], pr[1], short(node)))
1283 1300
1284 1301 def debugindexdot(ui, repo, file_):
1285 1302 """dump an index DAG as a graphviz dot file"""
@@ -4139,7 +4156,9 b' table = {'
4139 4156 _('[-e] DATE [RANGE]')),
4140 4157 "debugdata": (debugdata, [], _('FILE REV')),
4141 4158 "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
4142 "debugindex": (debugindex, [], _('FILE')),
4159 "debugindex": (debugindex,
4160 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
4161 _('FILE')),
4143 4162 "debugindexdot": (debugindexdot, [], _('FILE')),
4144 4163 "debuginstall": (debuginstall, [], ''),
4145 4164 "debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
@@ -37,12 +37,12 b''
37 37 $ hg mv afile anotherfile
38 38 $ hg commit -m "0.3m"
39 39
40 $ hg debugindex .hg/store/data/afile.i
41 rev offset length base linkrev nodeid p1 p2
42 0 0 3 0 0 362fef284ce2 000000000000 000000000000
43 1 3 5 1 1 125144f7e028 362fef284ce2 000000000000
44 2 8 7 2 2 4c982badb186 125144f7e028 000000000000
45 3 15 9 3 3 19b1fc555737 4c982badb186 000000000000
40 $ hg debugindex -f 1 .hg/store/data/afile.i
41 rev flag offset length size base link p1 p2 nodeid
42 0 0000 0 3 2 0 0 -1 -1 362fef284ce2
43 1 0000 3 5 4 1 1 0 -1 125144f7e028
44 2 0000 8 7 6 2 2 1 -1 4c982badb186
45 3 0000 15 9 8 3 3 2 -1 19b1fc555737
46 46
47 47 $ hg debugindex .hg/store/data/adifferentfile.i
48 48 rev offset length base linkrev nodeid p1 p2
@@ -212,7 +212,7 b' Show all commands + options'
212 212 debugdata:
213 213 debugdate: extended
214 214 debugfsinfo:
215 debugindex:
215 debugindex: format
216 216 debugindexdot:
217 217 debuginstall:
218 218 debugpushkey:
General Comments 0
You need to be logged in to leave comments. Login now