Patchwork D10992: dirstate-item: deprecate tuple access on the class

login
register
mail settings
Submitter phabricator
Date July 5, 2021, 9:35 a.m.
Message ID <differential-rev-PHID-DREV-xy26pyq2rnefsh62gun3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49304/
State Superseded
Headers show

Comments

phabricator - July 5, 2021, 9:35 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10992

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -64,12 +64,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)