This now has a dedicated Rust implementation
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/dirstatemap.py (19 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
92349ee98dd0 | 270b1b715978 | Raphaël Gomès | Mon, Mar 28, 12:02 PM |
Status | Author | Revision | |
---|---|---|---|
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare | ||
Needs Review | Alphare |
### method to manipulate the entries | ### method to manipulate the entries | ||||
def set_possibly_dirty(self, filename): | def set_possibly_dirty(self, filename): | ||||
"""record that the current state of the file on disk is unknown""" | """record that the current state of the file on disk is unknown""" | ||||
entry = self[filename] | entry = self[filename] | ||||
entry.set_possibly_dirty() | entry.set_possibly_dirty() | ||||
self._refresh_entry(filename, entry) | self._refresh_entry(filename, entry) | ||||
def set_clean(self, filename, mode, size, mtime): | |||||
"""mark a file as back to a clean state""" | |||||
entry = self[filename] | |||||
size = size & rangemask | |||||
entry.set_clean(mode, size, mtime) | |||||
self._refresh_entry(filename, entry) | |||||
self.copymap.pop(filename, None) | |||||
def set_untracked(self, f): | def set_untracked(self, f): | ||||
"""Mark a file as no longer tracked in the dirstate map""" | """Mark a file as no longer tracked in the dirstate map""" | ||||
entry = self.get(f) | entry = self.get(f) | ||||
if entry is None: | if entry is None: | ||||
return False | return False | ||||
else: | else: | ||||
self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added) | self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added) | ||||
if not entry.p2_info: | if not entry.p2_info: | ||||
else: | else: | ||||
# XXX This is probably overkill for more case, but we need this to | # XXX This is probably overkill for more case, but we need this to | ||||
# fully replace the `normallookup` call with `set_tracked` one. | # fully replace the `normallookup` call with `set_tracked` one. | ||||
# Consider smoothing this in the future. | # Consider smoothing this in the future. | ||||
entry.set_possibly_dirty() | entry.set_possibly_dirty() | ||||
self._refresh_entry(filename, entry) | self._refresh_entry(filename, entry) | ||||
return new | return new | ||||
def set_clean(self, filename, mode, size, mtime): | |||||
"""mark a file as back to a clean state""" | |||||
entry = self[filename] | |||||
size = size & rangemask | |||||
entry.set_clean(mode, size, mtime) | |||||
self._refresh_entry(filename, entry) | |||||
self.copymap.pop(filename, None) | |||||
def _refresh_entry(self, f, entry): | def _refresh_entry(self, f, entry): | ||||
if not entry.any_tracked: | if not entry.any_tracked: | ||||
self._map.pop(f, None) | self._map.pop(f, None) | ||||
def _drop_entry(self, f): | def _drop_entry(self, f): | ||||
self._map.pop(f, None) | self._map.pop(f, None) | ||||
self.copymap.pop(f, None) | self.copymap.pop(f, None) | ||||
if not entry.any_tracked: | if not entry.any_tracked: | ||||
self._map.drop_item_and_copy_source(f) | self._map.drop_item_and_copy_source(f) | ||||
else: | else: | ||||
self._map.addfile(f, entry) | self._map.addfile(f, entry) | ||||
def set_tracked(self, f): | def set_tracked(self, f): | ||||
return self._map.set_tracked(f) | return self._map.set_tracked(f) | ||||
def set_clean(self, filename, mode, size, mtime): | |||||
self._map.set_clean(filename, mode, size, mtime) | |||||
def reset_state( | def reset_state( | ||||
self, | self, | ||||
filename, | filename, | ||||
wc_tracked=False, | wc_tracked=False, | ||||
p1_tracked=False, | p1_tracked=False, | ||||
p2_info=False, | p2_info=False, | ||||
has_meaningful_mtime=True, | has_meaningful_mtime=True, | ||||
parentfiledata=None, | parentfiledata=None, |