changeset 48085:6a78715e56c8

dirstate: add a `get_entry` method to the dirstate This method give access to the underlying `DirstateEntry` object (or an empty one if None was there). It should allow us to use the more semantic property of the entry instead of the state where we needs it. Differential Revision: https://phab.mercurial-scm.org/D11522
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 29 Sep 2021 02:37:24 +0200
parents 596510cd2b12
children 80783e553bd5
files mercurial/dirstate.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Thu Sep 30 18:06:34 2021 +0200
+++ b/mercurial/dirstate.py	Wed Sep 29 02:37:24 2021 +0200
@@ -332,6 +332,13 @@
             return entry.state
         return b'?'
 
+    def get_entry(self, path):
+        """return a DirstateItem for the associated path"""
+        entry = self._map.get(path)
+        if entry is None:
+            return DirstateItem()
+        return entry
+
     def __contains__(self, key):
         return key in self._map