Patchwork D11953: dirstate: remove deprecated API

login
register
mail settings
Submitter phabricator
Date Dec. 23, 2021, 9:12 p.m.
Message ID <differential-rev-PHID-DREV-ex74fatcqkp4kzvoak2k-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50277/
State New
Headers show

Comments

phabricator - Dec. 23, 2021, 9:12 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py
  mercurial/interfaces/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/interfaces/dirstate.py b/mercurial/interfaces/dirstate.py
--- a/mercurial/interfaces/dirstate.py
+++ b/mercurial/interfaces/dirstate.py
@@ -66,17 +66,6 @@ 
     def pathto(f, cwd=None):
         pass
 
-    def __getitem__(key):
-        """Return the current state of key (a filename) in the dirstate.
-
-        States are:
-          n  normal
-          m  needs merging
-          r  marked for removal
-          a  marked for addition
-          ?  not tracked
-        """
-
     def __contains__(key):
         """Check if bytestring `key` is known to the dirstate."""
 
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -321,27 +321,6 @@ 
             return util.pconvert(path)
         return path
 
-    def __getitem__(self, key):
-        """Return the current state of key (a filename) in the dirstate.
-
-        States are:
-          n  normal
-          m  needs merging
-          r  marked for removal
-          a  marked for addition
-          ?  not tracked
-
-        XXX The "state" is a bit obscure to be in the "public" API. we should
-        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
-        return b'?'
-
     def get_entry(self, path):
         """return a DirstateItem for the associated path"""
         entry = self._map.get(path)