- skip-blame because we're just adding a prefix on a string prefix
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/dirstate.py (18 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
def invalidate(self): | def invalidate(self): | ||||
'''Causes the next access to reread the dirstate. | '''Causes the next access to reread the dirstate. | ||||
This is different from localrepo.invalidatedirstate() because it always | This is different from localrepo.invalidatedirstate() because it always | ||||
rereads the dirstate. Use localrepo.invalidatedirstate() if you want to | rereads the dirstate. Use localrepo.invalidatedirstate() if you want to | ||||
check whether the dirstate has changed before rereading it.''' | check whether the dirstate has changed before rereading it.''' | ||||
for a in ("_map", "_branch", "_ignore"): | for a in (r"_map", r"_branch", r"_ignore"): | ||||
if a in self.__dict__: | if a in self.__dict__: | ||||
delattr(self, a) | delattr(self, a) | ||||
self._lastnormaltime = 0 | self._lastnormaltime = 0 | ||||
self._dirty = False | self._dirty = False | ||||
self._updatedfiles.clear() | self._updatedfiles.clear() | ||||
self._parentwriters = 0 | self._parentwriters = 0 | ||||
self._origpl = None | self._origpl = None | ||||
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 addfile(self, f, oldstate, state, mode, size, mtime): | def addfile(self, f, oldstate, state, mode, size, mtime): | ||||
"""Add a tracked file to the dirstate.""" | """Add a tracked file to the dirstate.""" | ||||
if oldstate in "?r" and "_dirs" in self.__dict__: | if oldstate in "?r" and r"_dirs" in self.__dict__: | ||||
self._dirs.addpath(f) | self._dirs.addpath(f) | ||||
if oldstate == "?" and "_alldirs" in self.__dict__: | if oldstate == "?" and r"_alldirs" in self.__dict__: | ||||
self._alldirs.addpath(f) | self._alldirs.addpath(f) | ||||
self._map[f] = dirstatetuple(state, mode, size, mtime) | self._map[f] = dirstatetuple(state, mode, size, mtime) | ||||
if state != 'n' or mtime == -1: | if state != 'n' or mtime == -1: | ||||
self.nonnormalset.add(f) | self.nonnormalset.add(f) | ||||
if size == -2: | if size == -2: | ||||
self.otherparentset.add(f) | self.otherparentset.add(f) | ||||
def removefile(self, f, oldstate, size): | def removefile(self, f, oldstate, size): | ||||
""" | """ | ||||
Mark a file as removed in the dirstate. | Mark a file as removed in the dirstate. | ||||
The `size` parameter is used to store sentinel values that indicate | The `size` parameter is used to store sentinel values that indicate | ||||
the file's previous state. In the future, we should refactor this | the file's previous state. In the future, we should refactor this | ||||
to be more explicit about what that state is. | to be more explicit about what that state is. | ||||
""" | """ | ||||
if oldstate not in "?r" and "_dirs" in self.__dict__: | if oldstate not in "?r" and r"_dirs" in self.__dict__: | ||||
self._dirs.delpath(f) | self._dirs.delpath(f) | ||||
if oldstate == "?" and "_alldirs" in self.__dict__: | if oldstate == "?" and r"_alldirs" in self.__dict__: | ||||
self._alldirs.addpath(f) | self._alldirs.addpath(f) | ||||
if "filefoldmap" in self.__dict__: | if r"filefoldmap" in self.__dict__: | ||||
normed = util.normcase(f) | normed = util.normcase(f) | ||||
self.filefoldmap.pop(normed, None) | self.filefoldmap.pop(normed, None) | ||||
self._map[f] = dirstatetuple('r', 0, size, 0) | self._map[f] = dirstatetuple('r', 0, size, 0) | ||||
self.nonnormalset.add(f) | self.nonnormalset.add(f) | ||||
def dropfile(self, f, oldstate): | def dropfile(self, f, oldstate): | ||||
""" | """ | ||||
Remove a file from the dirstate. Returns True if the file was | Remove a file from the dirstate. Returns True if the file was | ||||
previously recorded. | previously recorded. | ||||
""" | """ | ||||
exists = self._map.pop(f, None) is not None | exists = self._map.pop(f, None) is not None | ||||
if exists: | if exists: | ||||
if oldstate != "r" and "_dirs" in self.__dict__: | if oldstate != "r" and r"_dirs" in self.__dict__: | ||||
self._dirs.delpath(f) | self._dirs.delpath(f) | ||||
if "_alldirs" in self.__dict__: | if r"_alldirs" in self.__dict__: | ||||
self._alldirs.delpath(f) | self._alldirs.delpath(f) | ||||
if "filefoldmap" in self.__dict__: | if r"filefoldmap" in self.__dict__: | ||||
normed = util.normcase(f) | normed = util.normcase(f) | ||||
self.filefoldmap.pop(normed, None) | self.filefoldmap.pop(normed, None) | ||||
self.nonnormalset.discard(f) | self.nonnormalset.discard(f) | ||||
return exists | return exists | ||||
def clearambiguoustimes(self, files, now): | def clearambiguoustimes(self, files, now): | ||||
for f in files: | for f in files: | ||||
e = self.get(f) | e = self.get(f) |