Mercurial > hg
diff mercurial/dirstate.py @ 47511:eaae39894312
dirstate: move most of the `remove` logic with dirstatemap `removefile`
This code deal with special logic to preserving "merged" and "from_p2" information when removing a file. These are implementation details that are more suitable for the dirstatemap layer. Since the dirstatemap layer alreaday have most of the information necessary to do so, the move is easy.
This move helps us to encapsulate more implementation details within the dirstatemap and its entry. Easing the use of a different storage for dirstate v2.
Differential Revision: https://phab.mercurial-scm.org/D10953
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 03 Jul 2021 19:52:00 +0200 |
parents | 94c58f3aab56 |
children | 769037a279ec |
line wrap: on
line diff
--- a/mercurial/dirstate.py Sat Jul 03 20:12:46 2021 +0200 +++ b/mercurial/dirstate.py Sat Jul 03 19:52:00 2021 +0200 @@ -559,21 +559,8 @@ def remove(self, f): '''Mark a file removed.''' self._dirty = True - oldstate = self[f] - size = 0 - if self.in_merge: - entry = self._map.get(f) - if entry is not None: - # backup the previous state - if entry[0] == b'm': # merge - size = NONNORMAL - elif entry[0] == b'n' and entry[2] == FROM_P2: # other parent - size = FROM_P2 - self._map.otherparentset.add(f) self._updatedfiles.add(f) - self._map.removefile(f, oldstate, size) - if size == 0: - self._map.copymap.pop(f, None) + self._map.removefile(f, in_merge=self.in_merge) def merge(self, f): '''Mark a file merged.'''