comparison mercurial/debugcommands.py @ 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 5363610f61ef
children ff97e793ed36
comparison
equal deleted inserted replaced
47567:7a15dea6d303 47568:85ce6ed51b9c
952 if opts.get('nodates') is not None: 952 if opts.get('nodates') is not None:
953 nodates = True 953 nodates = True
954 datesort = opts.get('datesort') 954 datesort = opts.get('datesort')
955 955
956 if datesort: 956 if datesort:
957 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename 957 keyfunc = lambda x: (
958 x[1].v1_mtime(),
959 x[0],
960 ) # sort by mtime, then by filename
958 else: 961 else:
959 keyfunc = None # sort by filename 962 keyfunc = None # sort by filename
960 entries = list(pycompat.iteritems(repo.dirstate)) 963 entries = list(pycompat.iteritems(repo.dirstate))
961 if opts['dirs']: 964 if opts['dirs']:
962 entries.extend(repo.dirstate.directories()) 965 entries.extend(repo.dirstate.directories())
963 entries.sort(key=keyfunc) 966 entries.sort(key=keyfunc)
964 for file_, ent in entries: 967 for file_, ent in entries:
965 if ent[3] == -1: 968 if ent.v1_mtime() == -1:
966 timestr = b'unset ' 969 timestr = b'unset '
967 elif nodates: 970 elif nodates:
968 timestr = b'set ' 971 timestr = b'set '
969 else: 972 else:
970 timestr = time.strftime( 973 timestr = time.strftime(
971 "%Y-%m-%d %H:%M:%S ", time.localtime(ent[3]) 974 "%Y-%m-%d %H:%M:%S ", time.localtime(ent.v1_mtime())
972 ) 975 )
973 timestr = encoding.strtolocal(timestr) 976 timestr = encoding.strtolocal(timestr)
974 if ent[1] & 0o20000: 977 if ent.mode & 0o20000:
975 mode = b'lnk' 978 mode = b'lnk'
976 else: 979 else:
977 mode = b'%3o' % (ent[1] & 0o777 & ~util.umask) 980 mode = b'%3o' % (ent.v1_mode() & 0o777 & ~util.umask)
978 ui.write(b"%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) 981 ui.write(
982 b"%c %s %10d %s%s\n"
983 % (ent.v1_state(), mode, ent.v1_size(), timestr, file_)
984 )
979 for f in repo.dirstate.copies(): 985 for f in repo.dirstate.copies():
980 ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) 986 ui.write(_(b"copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
981 987
982 988
983 @command( 989 @command(