There is a dedicated Rust implementation now
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 (31 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
dc7b5b1677d4 | 2f4497425c1d | Raphaël Gomès | Mon, Mar 28, 12:15 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 |
def _drop_entry(self, f): | def _drop_entry(self, f): | ||||
"""remove any entry for file f | """remove any entry for file f | ||||
This should also drop associated copy information | This should also drop associated copy information | ||||
The fact we actually need to drop it is the responsability of the caller""" | The fact we actually need to drop it is the responsability of the caller""" | ||||
### method to manipulate the entries | |||||
def set_untracked(self, f): | |||||
"""Mark a file as no longer tracked in the dirstate map""" | |||||
entry = self.get(f) | |||||
if entry is None: | |||||
return False | |||||
else: | |||||
self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added) | |||||
if not entry.p2_info: | |||||
self.copymap.pop(f, None) | |||||
entry.set_untracked() | |||||
self._refresh_entry(f, entry) | |||||
return True | |||||
### disk interaction | ### disk interaction | ||||
def _opendirstatefile(self): | def _opendirstatefile(self): | ||||
fp, mode = txnutil.trypending(self._root, self._opener, self._filename) | fp, mode = txnutil.trypending(self._root, self._opener, self._filename) | ||||
if self._pendingmode is not None and self._pendingmode != mode: | if self._pendingmode is not None and self._pendingmode != mode: | ||||
fp.close() | fp.close() | ||||
raise error.Abort( | raise error.Abort( | ||||
_(b'working directory state may be changed parallelly') | _(b'working directory state may be changed parallelly') | ||||
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_untracked(self, f): | |||||
"""Mark a file as no longer tracked in the dirstate map""" | |||||
entry = self.get(f) | |||||
if entry is None: | |||||
return False | |||||
else: | |||||
self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added) | |||||
if not entry.p2_info: | |||||
self.copymap.pop(f, None) | |||||
entry.set_untracked() | |||||
self._refresh_entry(f, entry) | |||||
return True | |||||
def set_clean(self, filename, mode, size, mtime): | def set_clean(self, filename, mode, size, mtime): | ||||
"""mark a file as back to a clean state""" | """mark a file as back to a clean state""" | ||||
entry = self[filename] | entry = self[filename] | ||||
size = size & rangemask | size = size & rangemask | ||||
entry.set_clean(mode, size, mtime) | entry.set_clean(mode, size, mtime) | ||||
self._refresh_entry(filename, entry) | self._refresh_entry(filename, entry) | ||||
self.copymap.pop(filename, None) | self.copymap.pop(filename, 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_untracked(self, f): | |||||
return self._map.set_untracked(f) | |||||
def set_clean(self, filename, mode, size, mtime): | def set_clean(self, filename, mode, size, mtime): | ||||
self._map.set_clean(filename, mode, size, mtime) | self._map.set_clean(filename, mode, size, mtime) | ||||
def set_possibly_dirty(self, f): | def set_possibly_dirty(self, f): | ||||
self._map.set_possibly_dirty(f) | self._map.set_possibly_dirty(f) | ||||
def reset_state( | def reset_state( | ||||
self, | self, |