Mercurial > public > mercurial-scm > hg
comparison rust/hg-core/src/dirstate_tree/dispatch.rs @ 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 | 8851acad5906 |
children | abed645b8e96 |
comparison
equal
deleted
inserted
replaced
47510:94c58f3aab56 | 47511:eaae39894312 |
---|---|
59 /// `size` is not actually a size but the 0 or -1 or -2 value that would be | 59 /// `size` is not actually a size but the 0 or -1 or -2 value that would be |
60 /// put in the size field in the dirstate-v1 format. | 60 /// put in the size field in the dirstate-v1 format. |
61 fn remove_file( | 61 fn remove_file( |
62 &mut self, | 62 &mut self, |
63 filename: &HgPath, | 63 filename: &HgPath, |
64 old_state: EntryState, | 64 in_merge: bool, |
65 size: i32, | |
66 ) -> Result<(), DirstateError>; | 65 ) -> Result<(), DirstateError>; |
67 | 66 |
68 /// Drop information about this file from the map if any, and return | 67 /// Drop information about this file from the map if any, and return |
69 /// whether there was any. | 68 /// whether there was any. |
70 /// | 69 /// |
293 } | 292 } |
294 | 293 |
295 fn remove_file( | 294 fn remove_file( |
296 &mut self, | 295 &mut self, |
297 filename: &HgPath, | 296 filename: &HgPath, |
298 old_state: EntryState, | 297 in_merge: bool, |
299 size: i32, | |
300 ) -> Result<(), DirstateError> { | 298 ) -> Result<(), DirstateError> { |
301 self.remove_file(filename, old_state, size) | 299 self.remove_file(filename, in_merge) |
302 } | 300 } |
303 | 301 |
304 fn drop_file( | 302 fn drop_file( |
305 &mut self, | 303 &mut self, |
306 filename: &HgPath, | 304 filename: &HgPath, |