changeset 48064:2943955304b3

dirstate: inline the merged_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/D11512
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 28 Sep 2021 19:12:44 +0200
parents e4c79a1a0b67
children 870100c0209b
files mercurial/cext/parsers.c mercurial/pure/parsers.py rust/hg-core/src/dirstate/entry.rs
diffstat 3 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/parsers.c	Tue Sep 28 18:57:20 2021 +0200
+++ b/mercurial/cext/parsers.c	Tue Sep 28 19:12:44 2021 +0200
@@ -210,7 +210,8 @@
 
 static inline int dirstate_item_c_v1_size(dirstateItemObject *self)
 {
-	if (dirstate_item_c_merged_removed(self)) {
+	if (dirstate_item_c_removed(self) &&
+	    (self->flags & dirstate_flag_merged)) {
 		return dirstate_v1_nonnormal;
 	} else if (dirstate_item_c_from_p2_removed(self)) {
 		return dirstate_v1_from_p2;
--- a/mercurial/pure/parsers.py	Tue Sep 28 18:57:20 2021 +0200
+++ b/mercurial/pure/parsers.py	Tue Sep 28 19:12:44 2021 +0200
@@ -386,7 +386,7 @@
             # the object has no state to record, this is -currently-
             # unsupported
             raise RuntimeError('untracked item')
-        elif self.merged_removed:
+        elif self.removed and self._merged:
             return NONNORMAL
         elif self.from_p2_removed:
             return FROM_P2
--- a/rust/hg-core/src/dirstate/entry.rs	Tue Sep 28 18:57:20 2021 +0200
+++ b/rust/hg-core/src/dirstate/entry.rs	Tue Sep 28 19:12:44 2021 +0200
@@ -216,7 +216,7 @@
     }
 
     pub fn size(&self) -> i32 {
-        if self.merged_removed() {
+        if self.removed() && self.flags.contains(Flags::MERGED) {
             SIZE_NON_NORMAL
         } else if self.from_p2_removed() {
             SIZE_FROM_OTHER_PARENT