changeset 47568:85ce6ed51b9c

dirstate-item: use the v1_serialization method in debugstate I am assuming the debug command are looking into the serialized format so I am using the `v1_` variants. This assumption might be wrong. Differential Revision: https://phab.mercurial-scm.org/D10988
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Jul 2021 06:44:49 +0200
parents 7a15dea6d303
children 7a4ba68f2373
files mercurial/debugcommands.py
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Mon Jul 05 10:32:49 2021 +0200
+++ b/mercurial/debugcommands.py	Mon Jul 05 06:44:49 2021 +0200
@@ -954,7 +954,10 @@
     datesort = opts.get('datesort')
 
     if datesort:
-        keyfunc = lambda x: (x[1][3], x[0])  # sort by mtime, then by filename
+        keyfunc = lambda x: (
+            x[1].v1_mtime(),
+            x[0],
+        )  # sort by mtime, then by filename
     else:
         keyfunc = None  # sort by filename
     entries = list(pycompat.iteritems(repo.dirstate))
@@ -962,20 +965,23 @@
         entries.extend(repo.dirstate.directories())
     entries.sort(key=keyfunc)
     for file_, ent in entries:
-        if ent[3] == -1:
+        if ent.v1_mtime() == -1:
             timestr = b'unset               '
         elif nodates:
             timestr = b'set                 '
         else:
             timestr = time.strftime(
-                "%Y-%m-%d %H:%M:%S ", time.localtime(ent[3])
+                "%Y-%m-%d %H:%M:%S ", time.localtime(ent.v1_mtime())
             )
             timestr = encoding.strtolocal(timestr)
-        if ent[1] & 0o20000:
+        if ent.mode & 0o20000:
             mode = b'lnk'
         else:
-            mode = b'%3o' % (ent[1] & 0o777 & ~util.umask)
-        ui.write(b"%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
+            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_)
+        )
     for f in repo.dirstate.copies():
         ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f))