Patchwork D11544: dirstate: deprecate `__getitem__` access

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2021, 9:42 a.m.
Message ID <differential-rev-PHID-DREV-hvfj665jrur4tlsuokkb-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49865/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2021, 9:42 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If we want to drop `state` usage, we need to deprecate this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -327,6 +327,8 @@ 
         consider migrating all user of this to going through the dirstate entry
         instead.
         """
+        msg = b"don't use dirstate[file], use dirstate.get_entry(file)"
+        util.nouideprecwarn(msg, b'6.1', stacklevel=2)
         entry = self._map.get(key)
         if entry is not None:
             return entry.state