This logic is complicated enough to deserves its own function. So it now does.
This will make it easier to reuse that logic in later changeset.
( )
Alphare | |
pulkit |
hg-reviewers |
This logic is complicated enough to deserves its own function. So it now does.
This will make it easier to reuse that logic in later changeset.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/dirstatemap.py (16 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
0dbcfe1f733d | d953458b3699 | Pierre-Yves David | Jul 14 2021, 7:58 PM |
def keys(self): | def keys(self): | ||||
return self._map.keys() | return self._map.keys() | ||||
def preload(self): | def preload(self): | ||||
"""Loads the underlying data, if it's not already loaded""" | """Loads the underlying data, if it's not already loaded""" | ||||
self._map | self._map | ||||
def _dirs_incr(self, filename, old_entry=None): | |||||
"""incremente the dirstate counter if applicable""" | |||||
if ( | |||||
old_entry is None or old_entry.removed | |||||
) and "_dirs" in self.__dict__: | |||||
self._dirs.addpath(filename) | |||||
if old_entry is None and "_alldirs" in self.__dict__: | |||||
self._alldirs.addpath(filename) | |||||
def addfile( | def addfile( | ||||
self, | self, | ||||
f, | f, | ||||
mode=0, | mode=0, | ||||
size=None, | size=None, | ||||
mtime=None, | mtime=None, | ||||
added=False, | added=False, | ||||
merged=False, | merged=False, | ||||
assert size != NONNORMAL | assert size != NONNORMAL | ||||
state = b'n' | state = b'n' | ||||
size = size & rangemask | size = size & rangemask | ||||
mtime = mtime & rangemask | mtime = mtime & rangemask | ||||
assert state is not None | assert state is not None | ||||
assert size is not None | assert size is not None | ||||
assert mtime is not None | assert mtime is not None | ||||
old_entry = self.get(f) | old_entry = self.get(f) | ||||
if ( | self._dirs_incr(f, old_entry) | ||||
old_entry is None or old_entry.removed | |||||
) and "_dirs" in self.__dict__: | |||||
self._dirs.addpath(f) | |||||
if old_entry is None and "_alldirs" in self.__dict__: | |||||
self._alldirs.addpath(f) | |||||
e = self._map[f] = DirstateItem(state, mode, size, mtime) | e = self._map[f] = DirstateItem(state, mode, size, mtime) | ||||
if e.dm_nonnormal: | if e.dm_nonnormal: | ||||
self.nonnormalset.add(f) | self.nonnormalset.add(f) | ||||
if e.dm_otherparent: | if e.dm_otherparent: | ||||
self.otherparentset.add(f) | self.otherparentset.add(f) | ||||
def removefile(self, f, in_merge=False): | def removefile(self, f, in_merge=False): | ||||
""" | """ |