dirstate-item: deprecate tuple access on the class
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 04 Jul 2021 23:41:54 +0200
changeset 47569 7a4ba68f2373
parent 47568 85ce6ed51b9c
child 47570 bc01b8ad6134
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
mercurial/pure/parsers.py
--- 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)