comparison rust/hg-core/src/dirstate/entry.rs @ 48134:3c7db97ce541

dirstate-item: implement `drop_merge_data` on the Rust DirstateItem It was currently missing and we want to be able to use in it the Rust case too. Differential Revision: https://phab.mercurial-scm.org/D11579
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 02 Oct 2021 00:14:32 +0200
parents 79bc60ca5946
children 38488d488ec1
comparison
equal deleted inserted replaced
48133:55293938b843 48134:3c7db97ce541
261 } else { 261 } else {
262 self.mtime 262 self.mtime
263 } 263 }
264 } 264 }
265 265
266 pub fn drop_merge_data(&mut self) {
267 if self.flags.contains(Flags::CLEAN_P1)
268 || self.flags.contains(Flags::CLEAN_P2)
269 || self.flags.contains(Flags::MERGED)
270 || self.flags.contains(Flags::P2_TRACKED)
271 {
272 if self.flags.contains(Flags::MERGED) {
273 self.flags.insert(Flags::P1_TRACKED);
274 } else {
275 self.flags.remove(Flags::P1_TRACKED);
276 }
277 self.flags.remove(
278 Flags::MERGED
279 | Flags::CLEAN_P1
280 | Flags::CLEAN_P2
281 | Flags::P2_TRACKED,
282 );
283 self.flags.insert(Flags::POSSIBLY_DIRTY);
284 self.mode = 0;
285 self.mtime = 0;
286 // size = None on the python size turn into size = NON_NORMAL when
287 // accessed. So the next line is currently required, but a some
288 // future clean up would be welcome.
289 self.size = SIZE_NON_NORMAL;
290 }
291 }
292
266 pub fn set_possibly_dirty(&mut self) { 293 pub fn set_possibly_dirty(&mut self) {
267 self.flags.insert(Flags::POSSIBLY_DIRTY) 294 self.flags.insert(Flags::POSSIBLY_DIRTY)
268 } 295 }
269 296
270 pub fn set_clean(&mut self, mode: i32, size: i32, mtime: i32) { 297 pub fn set_clean(&mut self, mode: i32, size: i32, mtime: i32) {