Mercurial > public > mercurial-scm > hg-stable
diff mercurial/debugcommands.py @ 48046:cedfe2606adf
debugsate: Change debug_iter() to yield tuples instead of DirstateItem
This removes the need for `DirstateItem`?to support the `state == ' '`
special case which represents dirstate tree nodes without an item.
Differential Revision: https://phab.mercurial-scm.org/D11463
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 20 Sep 2021 20:20:55 +0200 |
parents | 357307feaf61 |
children | c87844960a35 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Mon Sep 20 19:59:09 2021 +0200 +++ b/mercurial/debugcommands.py Mon Sep 20 20:20:55 2021 +0200 @@ -962,32 +962,29 @@ datesort = opts.get('datesort') if datesort: - keyfunc = lambda x: ( - x[1].v1_mtime(), - x[0], - ) # sort by mtime, then by filename + + def keyfunc(entry): + filename, _state, _mode, _size, mtime = entry + return (mtime, filename) + else: keyfunc = None # sort by filename entries = list(repo.dirstate._map.debug_iter(all=opts['all'])) entries.sort(key=keyfunc) - for file_, ent in entries: - if ent.v1_mtime() == -1: + for entry in entries: + filename, state, mode, size, mtime = entry + if mtime == -1: timestr = b'unset ' elif nodates: timestr = b'set ' else: - timestr = time.strftime( - "%Y-%m-%d %H:%M:%S ", time.localtime(ent.v1_mtime()) - ) + timestr = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(mtime)) timestr = encoding.strtolocal(timestr) - if ent.mode & 0o20000: + if mode & 0o20000: mode = b'lnk' else: - mode = b'%3o' % (ent.v1_mode() & 0o777 & ~util.umask) - ui.write( - b"%c %s %10d %s%s\n" - % (ent.v1_state(), mode, ent.v1_size(), timestr, file_) - ) + mode = b'%3o' % (mode & 0o777 & ~util.umask) + ui.write(b"%c %s %10d %s%s\n" % (state, mode, size, timestr, filename)) for f in repo.dirstate.copies(): ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f))