Mercurial > hg
comparison mercurial/dirstate.py @ 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 | 5d68c4eedd66 |
children | c87844960a35 |
comparison
equal
deleted
inserted
replaced
48084:596510cd2b12 | 48085:6a78715e56c8 |
---|---|
329 """ | 329 """ |
330 entry = self._map.get(key) | 330 entry = self._map.get(key) |
331 if entry is not None: | 331 if entry is not None: |
332 return entry.state | 332 return entry.state |
333 return b'?' | 333 return b'?' |
334 | |
335 def get_entry(self, path): | |
336 """return a DirstateItem for the associated path""" | |
337 entry = self._map.get(path) | |
338 if entry is None: | |
339 return DirstateItem() | |
340 return entry | |
334 | 341 |
335 def __contains__(self, key): | 342 def __contains__(self, key): |
336 return key in self._map | 343 return key in self._map |
337 | 344 |
338 def __iter__(self): | 345 def __iter__(self): |