changeset 47569:7a4ba68f2373

dirstate-item: deprecate tuple access on the class This should help us to catch and update the last user of this, especially in extensions. People will need to run the test with --pure to actually catch it, but this is better than nothing. Differential Revision: https://phab.mercurial-scm.org/D10992
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 04 Jul 2021 23:41:54 +0200
parents 85ce6ed51b9c
children bc01b8ad6134
files mercurial/pure/parsers.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Mon Jul 05 06:44:49 2021 +0200
+++ b/mercurial/pure/parsers.py	Sun Jul 04 23:41:54 2021 +0200
@@ -63,12 +63,20 @@
 
     def __getitem__(self, idx):
         if idx == 0 or idx == -4:
+            msg = b"do not use item[x], use item.state"
+            util.nouideprecwarn(msg, b'6.0', stacklevel=2)
             return self._state
         elif idx == 1 or idx == -3:
+            msg = b"do not use item[x], use item.mode"
+            util.nouideprecwarn(msg, b'6.0', stacklevel=2)
             return self._mode
         elif idx == 2 or idx == -2:
+            msg = b"do not use item[x], use item.size"
+            util.nouideprecwarn(msg, b'6.0', stacklevel=2)
             return self._size
         elif idx == 3 or idx == -1:
+            msg = b"do not use item[x], use item.mtime"
+            util.nouideprecwarn(msg, b'6.0', stacklevel=2)
             return self._mtime
         else:
             raise IndexError(idx)