Mercurial > hg
comparison mercurial/dirstatemap.py @ 48132:c057d7c97b72
dirstatemap: add a common `_drop_entry` method for dirstatemap
This method is called to remove DirstateItem from the map.
Each variant have a different implementation (which is … the point).
Differential Revision: https://phab.mercurial-scm.org/D11577
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 02 Oct 2021 00:01:56 +0200 |
parents | f903a357ba72 |
children | 55293938b843 |
comparison
equal
deleted
inserted
replaced
48131:f903a357ba72 | 48132:c057d7c97b72 |
---|---|
104 def _insert_entry(self, f, entry): | 104 def _insert_entry(self, f, entry): |
105 """add a new dirstate entry (or replace an unrelated one) | 105 """add a new dirstate entry (or replace an unrelated one) |
106 | 106 |
107 The fact it is actually new is the responsability of the caller | 107 The fact it is actually new is the responsability of the caller |
108 """ | 108 """ |
109 | |
110 def _drop_entry(self, f): | |
111 """remove any entry for file f | |
112 | |
113 This should also drop associated copy information | |
114 | |
115 The fact we actually need to drop it is the responsability of the caller""" | |
109 | 116 |
110 ### method to manipulate the entries | 117 ### method to manipulate the entries |
111 | 118 |
112 def set_possibly_dirty(self, filename): | 119 def set_possibly_dirty(self, filename): |
113 """record that the current state of the file on disk is unknown""" | 120 """record that the current state of the file on disk is unknown""" |
523 clean_p2=clean_p2, | 530 clean_p2=clean_p2, |
524 possibly_dirty=possibly_dirty, | 531 possibly_dirty=possibly_dirty, |
525 parentfiledata=parentfiledata, | 532 parentfiledata=parentfiledata, |
526 ) | 533 ) |
527 self._map[filename] = entry | 534 self._map[filename] = entry |
535 | |
536 def _drop_entry(self, f): | |
537 self._map.pop(f, None) | |
538 self._copymap.pop(f, None) | |
528 | 539 |
529 | 540 |
530 if rustmod is not None: | 541 if rustmod is not None: |
531 | 542 |
532 class dirstatemap(_dirstatemapcommon): | 543 class dirstatemap(_dirstatemapcommon): |
800 self._map.addfile(f, entry) | 811 self._map.addfile(f, entry) |
801 | 812 |
802 def _insert_entry(self, f, entry): | 813 def _insert_entry(self, f, entry): |
803 self._map.addfile(f, entry) | 814 self._map.addfile(f, entry) |
804 | 815 |
816 def _drop_entry(self, f): | |
817 self._map.drop_item_and_copy_source(f) | |
818 | |
805 def __setitem__(self, key, value): | 819 def __setitem__(self, key, value): |
806 assert isinstance(value, DirstateItem) | 820 assert isinstance(value, DirstateItem) |
807 self._map.set_dirstate_item(key, value) | 821 self._map.set_dirstate_item(key, value) |
808 | 822 |
809 def reset_state( | 823 def reset_state( |