1106 ui.write(_("(ignore rule in %s, line %d: '%s')\n") |
1106 ui.write(_("(ignore rule in %s, line %d: '%s')\n") |
1107 % (ignorefile, lineno, line)) |
1107 % (ignorefile, lineno, line)) |
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.openrevlog(repo, 'debugindex', file_, opts) |
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) |
1178 def debugindexdot(ui, repo, file_=None, **opts): |
1149 def debugindexdot(ui, repo, file_=None, **opts): |
1179 """dump an index DAG as a graphviz dot file""" |
1150 """dump an index DAG as a graphviz dot file""" |
2332 ui.write(('deltas against p2 : ') |
2303 ui.write(('deltas against p2 : ') |
2333 + fmt % pcfmt(nump2, numdeltas)) |
2304 + fmt % pcfmt(nump2, numdeltas)) |
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)')), |
2340 ('', 'show-revs', True, _('print list of result revisions (default)')), |
2376 ('', 'show-revs', True, _('print list of result revisions (default)')), |
2341 ('s', 'show-set', None, _('print internal representation of result set')), |
2377 ('s', 'show-set', None, _('print internal representation of result set')), |