##// END OF EJS Templates
debug-revlog: move the --dump code in `revlogutils` module...
marmoute -
r50554:7c0a3838 default
parent child Browse files
Show More
@@ -3240,51 +3240,7 b' def debugrevlog(ui, repo, file_=None, **'
3240 r = cmdutil.openrevlog(repo, b'debugrevlog', file_, opts)
3240 r = cmdutil.openrevlog(repo, b'debugrevlog', file_, opts)
3241
3241
3242 if opts.get(b"dump"):
3242 if opts.get(b"dump"):
3243 numrevs = len(r)
3243 revlog_debug.dump(ui, r)
3244 ui.write(
3245 (
3246 b"# rev p1rev p2rev start end deltastart base p1 p2"
3247 b" rawsize totalsize compression heads chainlen\n"
3248 )
3249 )
3250 ts = 0
3251 heads = set()
3252
3253 for rev in range(numrevs):
3254 dbase = r.deltaparent(rev)
3255 if dbase == -1:
3256 dbase = rev
3257 cbase = r.chainbase(rev)
3258 clen = r.chainlen(rev)
3259 p1, p2 = r.parentrevs(rev)
3260 rs = r.rawsize(rev)
3261 ts = ts + rs
3262 heads -= set(r.parentrevs(rev))
3263 heads.add(rev)
3264 try:
3265 compression = ts / r.end(rev)
3266 except ZeroDivisionError:
3267 compression = 0
3268 ui.write(
3269 b"%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
3270 b"%11d %5d %8d\n"
3271 % (
3272 rev,
3273 p1,
3274 p2,
3275 r.start(rev),
3276 r.end(rev),
3277 r.start(dbase),
3278 r.start(cbase),
3279 r.start(p1),
3280 r.start(p2),
3281 rs,
3282 ts,
3283 compression,
3284 len(heads),
3285 clen,
3286 )
3287 )
3288 return 0
3244 return 0
3289
3245
3290 format = r._format_version
3246 format = r._format_version
@@ -216,3 +216,54 b' def debug_index('
216 fm.plain(b'\n')
216 fm.plain(b'\n')
217
217
218 fm.end()
218 fm.end()
219
220
221 def dump(ui, revlog):
222 """perform the work for `hg debugrevlog --dump"""
223 # XXX seems redundant with debug index ?
224 r = revlog
225 numrevs = len(r)
226 ui.write(
227 (
228 b"# rev p1rev p2rev start end deltastart base p1 p2"
229 b" rawsize totalsize compression heads chainlen\n"
230 )
231 )
232 ts = 0
233 heads = set()
234
235 for rev in range(numrevs):
236 dbase = r.deltaparent(rev)
237 if dbase == -1:
238 dbase = rev
239 cbase = r.chainbase(rev)
240 clen = r.chainlen(rev)
241 p1, p2 = r.parentrevs(rev)
242 rs = r.rawsize(rev)
243 ts = ts + rs
244 heads -= set(r.parentrevs(rev))
245 heads.add(rev)
246 try:
247 compression = ts / r.end(rev)
248 except ZeroDivisionError:
249 compression = 0
250 ui.write(
251 b"%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d "
252 b"%11d %5d %8d\n"
253 % (
254 rev,
255 p1,
256 p2,
257 r.start(rev),
258 r.end(rev),
259 r.start(dbase),
260 r.start(cbase),
261 r.start(p1),
262 r.start(p2),
263 rs,
264 ts,
265 compression,
266 len(heads),
267 clen,
268 )
269 )
General Comments 0
You need to be logged in to leave comments. Login now