Show More
@@ -1108,70 +1108,41 def debugignore(ui, repo, *files, **opts | |||||
1108 | else: |
|
1108 | else: | |
1109 | ui.write(_("%s is not ignored\n") % m.uipath(f)) |
|
1109 | ui.write(_("%s is not ignored\n") % m.uipath(f)) | |
1110 |
|
1110 | |||
1111 | @command('debugindex', cmdutil.debugrevlogopts + |
|
1111 | @command('debugindex', cmdutil.debugrevlogopts + cmdutil.formatteropts, | |
1112 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
|
1112 | _('-c|-m|FILE')) | |
1113 | _('[-f FORMAT] -c|-m|FILE'), |
|
|||
1114 | optionalrepo=True) |
|
|||
1115 | def debugindex(ui, repo, file_=None, **opts): |
|
1113 | def debugindex(ui, repo, file_=None, **opts): | |
1116 | """dump the contents of an index file""" |
|
1114 | """dump index data for a storage primitive""" | |
1117 | opts = pycompat.byteskwargs(opts) |
|
1115 | opts = pycompat.byteskwargs(opts) | |
1118 |
r = cmdutil.openre |
|
1116 | store = cmdutil.openstorage(repo, 'debugindex', file_, opts) | |
1119 | format = opts.get('format', 0) |
|
|||
1120 | if format not in (0, 1): |
|
|||
1121 | raise error.Abort(_("unknown format %d") % format) |
|
|||
1122 |
|
1117 | |||
1123 | if ui.debugflag: |
|
1118 | if ui.debugflag: | |
1124 | shortfn = hex |
|
1119 | shortfn = hex | |
1125 | else: |
|
1120 | else: | |
1126 | shortfn = short |
|
1121 | shortfn = short | |
1127 |
|
1122 | |||
1128 | # There might not be anything in r, so have a sane default |
|
|||
1129 | idlen = 12 |
|
1123 | idlen = 12 | |
1130 | for i in r: |
|
1124 | for i in store: | |
1131 | idlen = len(shortfn(r.node(i))) |
|
1125 | idlen = len(shortfn(store.node(i))) | |
1132 | break |
|
1126 | break | |
1133 |
|
1127 | |||
1134 | if format == 0: |
|
1128 | fm = ui.formatter('debugindex', opts) | |
1135 | if ui.verbose: |
|
1129 | fm.plain(b' rev linkrev %s %s p2\n' % ( | |
1136 | ui.write((" rev offset length linkrev" |
|
1130 | b'nodeid'.ljust(idlen), | |
1137 | " %s %s p2\n") % ("nodeid".ljust(idlen), |
|
1131 | b'p1'.ljust(idlen))) | |
1138 | "p1".ljust(idlen))) |
|
1132 | ||
1139 | else: |
|
1133 | for rev in store: | |
1140 | ui.write((" rev linkrev %s %s p2\n") % ( |
|
1134 | node = store.node(rev) | |
1141 | "nodeid".ljust(idlen), "p1".ljust(idlen))) |
|
1135 | parents = store.parents(node) | |
1142 | elif format == 1: |
|
1136 | ||
1143 | if ui.verbose: |
|
1137 | fm.startitem() | |
1144 | ui.write((" rev flag offset length size link p1" |
|
1138 | fm.write(b'rev', b'%6d ', rev) | |
1145 | " p2 %s\n") % "nodeid".rjust(idlen)) |
|
1139 | fm.write(b'linkrev', '%7d ', store.linkrev(rev)) | |
1146 | else: |
|
1140 | fm.write(b'node', '%s ', shortfn(node)) | |
1147 | ui.write((" rev flag size link p1 p2 %s\n") % |
|
1141 | fm.write(b'p1', '%s ', shortfn(parents[0])) | |
1148 | "nodeid".rjust(idlen)) |
|
1142 | fm.write(b'p2', '%s', shortfn(parents[1])) | |
1149 |
|
1143 | fm.plain(b'\n') | ||
1150 | for i in r: |
|
1144 | ||
1151 | node = r.node(i) |
|
1145 | fm.end() | |
1152 | if format == 0: |
|
|||
1153 | try: |
|
|||
1154 | pp = r.parents(node) |
|
|||
1155 | except Exception: |
|
|||
1156 | pp = [nullid, nullid] |
|
|||
1157 | if ui.verbose: |
|
|||
1158 | ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( |
|
|||
1159 | i, r.start(i), r.length(i), r.linkrev(i), |
|
|||
1160 | shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) |
|
|||
1161 | else: |
|
|||
1162 | ui.write("% 6d % 7d %s %s %s\n" % ( |
|
|||
1163 | i, r.linkrev(i), shortfn(node), shortfn(pp[0]), |
|
|||
1164 | shortfn(pp[1]))) |
|
|||
1165 | elif format == 1: |
|
|||
1166 | pr = r.parentrevs(i) |
|
|||
1167 | if ui.verbose: |
|
|||
1168 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( |
|
|||
1169 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
|
|||
1170 | r.linkrev(i), pr[0], pr[1], shortfn(node))) |
|
|||
1171 | else: |
|
|||
1172 | ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % ( |
|
|||
1173 | i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1], |
|
|||
1174 | shortfn(node))) |
|
|||
1175 |
|
1146 | |||
1176 | @command('debugindexdot', cmdutil.debugrevlogopts, |
|
1147 | @command('debugindexdot', cmdutil.debugrevlogopts, | |
1177 | _('-c|-m|FILE'), optionalrepo=True) |
|
1148 | _('-c|-m|FILE'), optionalrepo=True) | |
@@ -2334,6 +2305,71 def debugrevlog(ui, repo, file_=None, ** | |||||
2334 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, |
|
2305 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, | |
2335 | numdeltas)) |
|
2306 | numdeltas)) | |
2336 |
|
2307 | |||
|
2308 | @command('debugrevlogindex', cmdutil.debugrevlogopts + | |||
|
2309 | [('f', 'format', 0, _('revlog format'), _('FORMAT'))], | |||
|
2310 | _('[-f FORMAT] -c|-m|FILE'), | |||
|
2311 | optionalrepo=True) | |||
|
2312 | def debugrevlogindex(ui, repo, file_=None, **opts): | |||
|
2313 | """dump the contents of a revlog index""" | |||
|
2314 | opts = pycompat.byteskwargs(opts) | |||
|
2315 | r = cmdutil.openrevlog(repo, 'debugrevlogindex', file_, opts) | |||
|
2316 | format = opts.get('format', 0) | |||
|
2317 | if format not in (0, 1): | |||
|
2318 | raise error.Abort(_("unknown format %d") % format) | |||
|
2319 | ||||
|
2320 | if ui.debugflag: | |||
|
2321 | shortfn = hex | |||
|
2322 | else: | |||
|
2323 | shortfn = short | |||
|
2324 | ||||
|
2325 | # There might not be anything in r, so have a sane default | |||
|
2326 | idlen = 12 | |||
|
2327 | for i in r: | |||
|
2328 | idlen = len(shortfn(r.node(i))) | |||
|
2329 | break | |||
|
2330 | ||||
|
2331 | if format == 0: | |||
|
2332 | if ui.verbose: | |||
|
2333 | ui.write((" rev offset length linkrev" | |||
|
2334 | " %s %s p2\n") % ("nodeid".ljust(idlen), | |||
|
2335 | "p1".ljust(idlen))) | |||
|
2336 | else: | |||
|
2337 | ui.write((" rev linkrev %s %s p2\n") % ( | |||
|
2338 | "nodeid".ljust(idlen), "p1".ljust(idlen))) | |||
|
2339 | elif format == 1: | |||
|
2340 | if ui.verbose: | |||
|
2341 | ui.write((" rev flag offset length size link p1" | |||
|
2342 | " p2 %s\n") % "nodeid".rjust(idlen)) | |||
|
2343 | else: | |||
|
2344 | ui.write((" rev flag size link p1 p2 %s\n") % | |||
|
2345 | "nodeid".rjust(idlen)) | |||
|
2346 | ||||
|
2347 | for i in r: | |||
|
2348 | node = r.node(i) | |||
|
2349 | if format == 0: | |||
|
2350 | try: | |||
|
2351 | pp = r.parents(node) | |||
|
2352 | except Exception: | |||
|
2353 | pp = [nullid, nullid] | |||
|
2354 | if ui.verbose: | |||
|
2355 | ui.write("% 6d % 9d % 7d % 7d %s %s %s\n" % ( | |||
|
2356 | i, r.start(i), r.length(i), r.linkrev(i), | |||
|
2357 | shortfn(node), shortfn(pp[0]), shortfn(pp[1]))) | |||
|
2358 | else: | |||
|
2359 | ui.write("% 6d % 7d %s %s %s\n" % ( | |||
|
2360 | i, r.linkrev(i), shortfn(node), shortfn(pp[0]), | |||
|
2361 | shortfn(pp[1]))) | |||
|
2362 | elif format == 1: | |||
|
2363 | pr = r.parentrevs(i) | |||
|
2364 | if ui.verbose: | |||
|
2365 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d %s\n" % ( | |||
|
2366 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), | |||
|
2367 | r.linkrev(i), pr[0], pr[1], shortfn(node))) | |||
|
2368 | else: | |||
|
2369 | ui.write("% 6d %04x % 8d % 6d % 6d % 6d %s\n" % ( | |||
|
2370 | i, r.flags(i), r.rawsize(i), r.linkrev(i), pr[0], pr[1], | |||
|
2371 | shortfn(node))) | |||
|
2372 | ||||
2337 | @command('debugrevspec', |
|
2373 | @command('debugrevspec', | |
2338 | [('', 'optimize', None, |
|
2374 | [('', 'optimize', None, | |
2339 | _('print parsed tree after optimizing (DEPRECATED)')), |
|
2375 | _('print parsed tree after optimizing (DEPRECATED)')), |
@@ -37,7 +37,7 | |||||
37 | $ hg mv afile anotherfile |
|
37 | $ hg mv afile anotherfile | |
38 | $ hg commit -m "0.3m" |
|
38 | $ hg commit -m "0.3m" | |
39 |
|
39 | |||
40 | $ hg debugindex -f 1 afile |
|
40 | $ hg debugrevlogindex -f 1 afile | |
41 | rev flag size link p1 p2 nodeid |
|
41 | rev flag size link p1 p2 nodeid | |
42 | 0 0000 2 0 -1 -1 362fef284ce2 |
|
42 | 0 0000 2 0 -1 -1 362fef284ce2 | |
43 | 1 0000 4 1 0 -1 125144f7e028 |
|
43 | 1 0000 4 1 0 -1 125144f7e028 |
@@ -111,6 +111,7 Show debug commands if there are no othe | |||||
111 | debugrebuildfncache |
|
111 | debugrebuildfncache | |
112 | debugrename |
|
112 | debugrename | |
113 | debugrevlog |
|
113 | debugrevlog | |
|
114 | debugrevlogindex | |||
114 | debugrevspec |
|
115 | debugrevspec | |
115 | debugserve |
|
116 | debugserve | |
116 | debugsetparents |
|
117 | debugsetparents | |
@@ -279,7 +280,7 Show all commands + options | |||||
279 | debugfsinfo: |
|
280 | debugfsinfo: | |
280 | debuggetbundle: head, common, type |
|
281 | debuggetbundle: head, common, type | |
281 | debugignore: |
|
282 | debugignore: | |
282 |
debugindex: changelog, manifest, dir, |
|
283 | debugindex: changelog, manifest, dir, template | |
283 | debugindexdot: changelog, manifest, dir |
|
284 | debugindexdot: changelog, manifest, dir | |
284 | debuginstall: template |
|
285 | debuginstall: template | |
285 | debugknown: |
|
286 | debugknown: | |
@@ -298,6 +299,7 Show all commands + options | |||||
298 | debugrebuildfncache: |
|
299 | debugrebuildfncache: | |
299 | debugrename: rev |
|
300 | debugrename: rev | |
300 | debugrevlog: changelog, manifest, dir, dump |
|
301 | debugrevlog: changelog, manifest, dir, dump | |
|
302 | debugrevlogindex: changelog, manifest, dir, format | |||
301 | debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized |
|
303 | debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized | |
302 | debugserve: sshstdio, logiofd, logiofile |
|
304 | debugserve: sshstdio, logiofd, logiofile | |
303 | debugsetparents: |
|
305 | debugsetparents: |
@@ -119,34 +119,61 | |||||
119 | #endif |
|
119 | #endif | |
120 |
|
120 | |||
121 | Test debugindex, with and without the --verbose/--debug flag |
|
121 | Test debugindex, with and without the --verbose/--debug flag | |
122 | $ hg debugindex a |
|
122 | $ hg debugrevlogindex a | |
123 | rev linkrev nodeid p1 p2 |
|
123 | rev linkrev nodeid p1 p2 | |
124 | 0 0 b789fdd96dc2 000000000000 000000000000 |
|
124 | 0 0 b789fdd96dc2 000000000000 000000000000 | |
125 |
|
125 | |||
126 | #if no-reposimplestore |
|
126 | #if no-reposimplestore | |
127 | $ hg --verbose debugindex a |
|
127 | $ hg --verbose debugrevlogindex a | |
128 | rev offset length linkrev nodeid p1 p2 |
|
128 | rev offset length linkrev nodeid p1 p2 | |
129 | 0 0 3 0 b789fdd96dc2 000000000000 000000000000 |
|
129 | 0 0 3 0 b789fdd96dc2 000000000000 000000000000 | |
130 |
|
130 | |||
131 | $ hg --debug debugindex a |
|
131 | $ hg --debug debugrevlogindex a | |
132 | rev offset length linkrev nodeid p1 p2 |
|
132 | rev offset length linkrev nodeid p1 p2 | |
133 | 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 |
|
133 | 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 | |
134 | #endif |
|
134 | #endif | |
135 |
|
135 | |||
136 | $ hg debugindex -f 1 a |
|
136 | $ hg debugrevlogindex -f 1 a | |
137 | rev flag size link p1 p2 nodeid |
|
137 | rev flag size link p1 p2 nodeid | |
138 | 0 0000 2 0 -1 -1 b789fdd96dc2 |
|
138 | 0 0000 2 0 -1 -1 b789fdd96dc2 | |
139 |
|
139 | |||
140 | #if no-reposimplestore |
|
140 | #if no-reposimplestore | |
141 | $ hg --verbose debugindex -f 1 a |
|
141 | $ hg --verbose debugrevlogindex -f 1 a | |
142 | rev flag offset length size link p1 p2 nodeid |
|
142 | rev flag offset length size link p1 p2 nodeid | |
143 | 0 0000 0 3 2 0 -1 -1 b789fdd96dc2 |
|
143 | 0 0000 0 3 2 0 -1 -1 b789fdd96dc2 | |
144 |
|
144 | |||
145 | $ hg --debug debugindex -f 1 a |
|
145 | $ hg --debug debugrevlogindex -f 1 a | |
146 | rev flag offset length size link p1 p2 nodeid |
|
146 | rev flag offset length size link p1 p2 nodeid | |
147 | 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 |
|
147 | 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 | |
148 | #endif |
|
148 | #endif | |
149 |
|
149 | |||
|
150 | $ hg debugindex -c | |||
|
151 | rev linkrev nodeid p1 p2 | |||
|
152 | 0 0 07f494440405 000000000000 000000000000 | |||
|
153 | 1 1 8cccb4b5fec2 07f494440405 000000000000 | |||
|
154 | 2 2 b1e228c512c5 8cccb4b5fec2 000000000000 | |||
|
155 | $ hg debugindex -c --debug | |||
|
156 | rev linkrev nodeid p1 p2 | |||
|
157 | 0 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 | |||
|
158 | 1 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000 | |||
|
159 | 2 2 b1e228c512c5d7066d70562ed839c3323a62d6d2 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 0000000000000000000000000000000000000000 | |||
|
160 | $ hg debugindex -m | |||
|
161 | rev linkrev nodeid p1 p2 | |||
|
162 | 0 0 a0c8bcbbb45c 000000000000 000000000000 | |||
|
163 | 1 1 57faf8a737ae a0c8bcbbb45c 000000000000 | |||
|
164 | 2 2 a35b10320954 57faf8a737ae 000000000000 | |||
|
165 | $ hg debugindex -m --debug | |||
|
166 | rev linkrev nodeid p1 p2 | |||
|
167 | 0 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 | |||
|
168 | 1 1 57faf8a737ae7faf490582941a82319ba6529dca a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000 | |||
|
169 | 2 2 a35b103209548032201c16c7688cb2657f037a38 57faf8a737ae7faf490582941a82319ba6529dca 0000000000000000000000000000000000000000 | |||
|
170 | $ hg debugindex a | |||
|
171 | rev linkrev nodeid p1 p2 | |||
|
172 | 0 0 b789fdd96dc2 000000000000 000000000000 | |||
|
173 | $ hg debugindex --debug a | |||
|
174 | rev linkrev nodeid p1 p2 | |||
|
175 | 0 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 | |||
|
176 | ||||
150 | debugdelta chain basic output |
|
177 | debugdelta chain basic output | |
151 |
|
178 | |||
152 | #if reporevlogstore |
|
179 | #if reporevlogstore |
@@ -938,7 +938,7 Test list of internal help commands | |||||
938 | retrieves a bundle from a repo |
|
938 | retrieves a bundle from a repo | |
939 | debugignore display the combined ignore pattern and information about |
|
939 | debugignore display the combined ignore pattern and information about | |
940 | ignored files |
|
940 | ignored files | |
941 | debugindex dump the contents of an index file |
|
941 | debugindex dump index data for a storage primitive | |
942 | debugindexdot |
|
942 | debugindexdot | |
943 | dump an index DAG as a graphviz dot file |
|
943 | dump an index DAG as a graphviz dot file | |
944 | debuginstall test Mercurial installation |
|
944 | debuginstall test Mercurial installation | |
@@ -970,6 +970,8 Test list of internal help commands | |||||
970 | rebuild the fncache file |
|
970 | rebuild the fncache file | |
971 | debugrename dump rename information |
|
971 | debugrename dump rename information | |
972 | debugrevlog show data and statistics about a revlog |
|
972 | debugrevlog show data and statistics about a revlog | |
|
973 | debugrevlogindex | |||
|
974 | dump the contents of a revlog index | |||
973 | debugrevspec parse and apply a revision specification |
|
975 | debugrevspec parse and apply a revision specification | |
974 | debugserve run a server with advanced settings |
|
976 | debugserve run a server with advanced settings | |
975 | debugsetparents |
|
977 | debugsetparents |
@@ -145,7 +145,7 Test corrupted p1/p2 fields that could c | |||||
145 | > open(n + b"/.hg/store/00changelog.i", "wb").write(d) |
|
145 | > open(n + b"/.hg/store/00changelog.i", "wb").write(d) | |
146 | > EOF |
|
146 | > EOF | |
147 |
|
147 | |||
148 | $ hg -R limit debugindex -f1 -c |
|
148 | $ hg -R limit debugrevlogindex -f1 -c | |
149 | rev flag size link p1 p2 nodeid |
|
149 | rev flag size link p1 p2 nodeid | |
150 | 0 0000 62 0 2 -1 7c31755bf9b5 |
|
150 | 0 0000 62 0 2 -1 7c31755bf9b5 | |
151 | 1 0000 65 1 0 2 26333235a41c |
|
151 | 1 0000 65 1 0 2 26333235a41c | |
@@ -155,7 +155,7 Test corrupted p1/p2 fields that could c | |||||
155 | 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000 |
|
155 | 0 1 1 -1 base 63 62 63 1.01613 63 0 0.00000 | |
156 | 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000 |
|
156 | 1 2 1 -1 base 66 65 66 1.01538 66 0 0.00000 | |
157 |
|
157 | |||
158 | $ hg -R segv debugindex -f1 -c |
|
158 | $ hg -R segv debugrevlogindex -f1 -c | |
159 | rev flag size link p1 p2 nodeid |
|
159 | rev flag size link p1 p2 nodeid | |
160 | 0 0000 62 0 65536 -1 7c31755bf9b5 |
|
160 | 0 0000 62 0 65536 -1 7c31755bf9b5 | |
161 | 1 0000 65 1 0 65536 26333235a41c |
|
161 | 1 0000 65 1 0 65536 26333235a41c |
@@ -39,7 +39,7 Test for CVE-2016-3630 | |||||
39 | ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA==""" |
|
39 | ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA==""" | |
40 | ... .decode("base64").decode("zlib")) |
|
40 | ... .decode("base64").decode("zlib")) | |
41 |
|
41 | |||
42 | $ hg debugindex a.i |
|
42 | $ hg debugrevlogindex a.i | |
43 | rev linkrev nodeid p1 p2 |
|
43 | rev linkrev nodeid p1 p2 | |
44 | 0 2 99e0332bd498 000000000000 000000000000 |
|
44 | 0 2 99e0332bd498 000000000000 000000000000 | |
45 | 1 3 6674f57a23d8 99e0332bd498 000000000000 |
|
45 | 1 3 6674f57a23d8 99e0332bd498 000000000000 |
General Comments 0
You need to be logged in to leave comments.
Login now