Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG934a6213fee9: dirstate: remove deprecated API
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/dirstate.py (21 lines) | |||
M | mercurial/interfaces/dirstate.py (11 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
906d5968b03d | 5ac06c661db9 | Raphaël Gomès | Dec 23 2021, 8:49 AM |
def pathto(self, f, cwd=None): | def pathto(self, f, cwd=None): | ||||
if cwd is None: | if cwd is None: | ||||
cwd = self.getcwd() | cwd = self.getcwd() | ||||
path = util.pathto(self._root, cwd, f) | path = util.pathto(self._root, cwd, f) | ||||
if self._slash: | if self._slash: | ||||
return util.pconvert(path) | return util.pconvert(path) | ||||
return 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): | def get_entry(self, path): | ||||
"""return a DirstateItem for the associated path""" | """return a DirstateItem for the associated path""" | ||||
entry = self._map.get(path) | entry = self._map.get(path) | ||||
if entry is None: | if entry is None: | ||||
return DirstateItem() | return DirstateItem() | ||||
return entry | return entry | ||||
def __contains__(self, key): | def __contains__(self, key): |
This path should be used to resolve file patterns or to convert | This path should be used to resolve file patterns or to convert | ||||
canonical paths back to file paths for display. It shouldn't be | canonical paths back to file paths for display. It shouldn't be | ||||
used to get real file paths. Use vfs functions instead. | used to get real file paths. Use vfs functions instead. | ||||
""" | """ | ||||
def pathto(f, cwd=None): | def pathto(f, cwd=None): | ||||
pass | 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): | def __contains__(key): | ||||
"""Check if bytestring `key` is known to the dirstate.""" | """Check if bytestring `key` is known to the dirstate.""" | ||||
def __iter__(): | def __iter__(): | ||||
"""Iterate the dirstate's contained filenames as bytestrings.""" | """Iterate the dirstate's contained filenames as bytestrings.""" | ||||
def items(): | def items(): | ||||
"""Iterate the dirstate's entries as (filename, DirstateItem. | """Iterate the dirstate's entries as (filename, DirstateItem. |