This was needed as a compatibility layer for the Python and Rust
implementations, but it is not called from anywhere in Rust anymore.
The two remaining calls have been inlined.
marmoute |
hg-reviewers |
This was needed as a compatibility layer for the Python and Rust
implementations, but it is not called from anywhere in Rust anymore.
The two remaining calls have been inlined.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/dirstatemap.py (16 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
6a3b53e249f9 | 34116e5d2935 | Raphaël Gomès | Mar 23 2022, 12:13 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare | ||
Closed | Alphare |
This might be a no-op for some subclasses who deal with directory | This might be a no-op for some subclasses who deal with directory | ||||
tracking in a different way. | tracking in a different way. | ||||
""" | """ | ||||
def _refresh_entry(self, f, entry): | def _refresh_entry(self, f, entry): | ||||
"""record updated state of an entry""" | """record updated state of an entry""" | ||||
def _insert_entry(self, f, entry): | |||||
"""add a new dirstate entry (or replace an unrelated one) | |||||
The fact it is actually new is the responsability of the caller | |||||
""" | |||||
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 | ### method to manipulate the entries | ||||
self._dirs_incr(filename, old_entry) | self._dirs_incr(filename, old_entry) | ||||
entry = DirstateItem( | entry = DirstateItem( | ||||
wc_tracked=wc_tracked, | wc_tracked=wc_tracked, | ||||
p1_tracked=p1_tracked, | p1_tracked=p1_tracked, | ||||
p2_info=p2_info, | p2_info=p2_info, | ||||
has_meaningful_mtime=has_meaningful_mtime, | has_meaningful_mtime=has_meaningful_mtime, | ||||
parentfiledata=parentfiledata, | parentfiledata=parentfiledata, | ||||
) | ) | ||||
self._insert_entry(filename, entry) | self._map[filename] = entry | ||||
def set_tracked(self, filename): | def set_tracked(self, filename): | ||||
new = False | new = False | ||||
entry = self.get(filename) | entry = self.get(filename) | ||||
if entry is None: | if entry is None: | ||||
self._dirs_incr(filename) | self._dirs_incr(filename) | ||||
entry = DirstateItem( | entry = DirstateItem( | ||||
wc_tracked=True, | wc_tracked=True, | ||||
) | ) | ||||
self._insert_entry(filename, entry) | self._map[filename] = entry | ||||
new = True | new = True | ||||
elif not entry.tracked: | elif not entry.tracked: | ||||
self._dirs_incr(filename, entry) | self._dirs_incr(filename, entry) | ||||
entry.set_tracked() | entry.set_tracked() | ||||
self._refresh_entry(filename, entry) | self._refresh_entry(filename, entry) | ||||
new = True | new = True | ||||
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 _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 _insert_entry(self, f, entry): | |||||
self._map[f] = entry | |||||
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 rustmod is not None: | if rustmod is not None: | ||||
class dirstatemap(_dirstatemapcommon): | class dirstatemap(_dirstatemapcommon): | ||||
### code related to manipulation of entries and copy-sources | ### code related to manipulation of entries and copy-sources | ||||
def _refresh_entry(self, f, entry): | def _refresh_entry(self, f, entry): | ||||
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 _insert_entry(self, 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 reset_state( | def reset_state( | ||||
self, | self, | ||||
filename, | filename, | ||||
wc_tracked=False, | wc_tracked=False, | ||||
p1_tracked=False, | p1_tracked=False, |