Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/entry.rs Sat Oct 02 00:02:55 2021 +0200 +++ b/rust/hg-core/src/dirstate/entry.rs Sat Oct 02 00:14:32 2021 +0200 @@ -263,6 +263,33 @@ } } + pub fn drop_merge_data(&mut self) { + if self.flags.contains(Flags::CLEAN_P1) + || self.flags.contains(Flags::CLEAN_P2) + || self.flags.contains(Flags::MERGED) + || self.flags.contains(Flags::P2_TRACKED) + { + if self.flags.contains(Flags::MERGED) { + self.flags.insert(Flags::P1_TRACKED); + } else { + self.flags.remove(Flags::P1_TRACKED); + } + self.flags.remove( + Flags::MERGED + | Flags::CLEAN_P1 + | Flags::CLEAN_P2 + | Flags::P2_TRACKED, + ); + self.flags.insert(Flags::POSSIBLY_DIRTY); + self.mode = 0; + self.mtime = 0; + // size = None on the python size turn into size = NON_NORMAL when + // accessed. So the next line is currently required, but a some + // future clean up would be welcome. + self.size = SIZE_NON_NORMAL; + } + } + pub fn set_possibly_dirty(&mut self) { self.flags.insert(Flags::POSSIBLY_DIRTY) }