dirstate: inline the `from_p2_removed` logic
It is used internally for compatibilty with size used in the `v1` format, but
this is the only use. So we can simply inline it.
Differential Revision: https://phab.mercurial-scm.org/D11514
--- a/mercurial/cext/parsers.c Tue Sep 28 19:15:46 2021 +0200
+++ b/mercurial/cext/parsers.c Tue Sep 28 19:29:44 2021 +0200
@@ -205,7 +205,8 @@
if (dirstate_item_c_removed(self) &&
(self->flags & dirstate_flag_merged)) {
return dirstate_v1_nonnormal;
- } else if (dirstate_item_c_from_p2_removed(self)) {
+ } else if (dirstate_item_c_removed(self) &&
+ (self->flags & dirstate_flag_clean_p2)) {
return dirstate_v1_from_p2;
} else if (dirstate_item_c_removed(self)) {
return 0;
--- a/mercurial/pure/parsers.py Tue Sep 28 19:15:46 2021 +0200
+++ b/mercurial/pure/parsers.py Tue Sep 28 19:29:44 2021 +0200
@@ -379,7 +379,7 @@
raise RuntimeError('untracked item')
elif self.removed and self._merged:
return NONNORMAL
- elif self.from_p2_removed:
+ elif self.removed and self._clean_p2:
return FROM_P2
elif self.removed:
return 0
--- a/rust/hg-core/src/dirstate/entry.rs Tue Sep 28 19:15:46 2021 +0200
+++ b/rust/hg-core/src/dirstate/entry.rs Tue Sep 28 19:29:44 2021 +0200
@@ -214,7 +214,7 @@
pub fn size(&self) -> i32 {
if self.removed() && self.flags.contains(Flags::MERGED) {
SIZE_NON_NORMAL
- } else if self.from_p2_removed() {
+ } else if self.removed() && self.flags.contains(Flags::CLEAN_P2) {
SIZE_FROM_OTHER_PARENT
} else if self.removed() {
0