Patchwork D11512: dirstate: inline the merged_removed logic

login
register
mail settings
Submitter phabricator
Date Sept. 29, 2021, 8:37 a.m.
Message ID <differential-rev-PHID-DREV-aqspd4z4creui6p6mdfh-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49836/
State Superseded
Headers show

Comments

phabricator - Sept. 29, 2021, 8:37 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11512

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate/entry.rs

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/dirstate/entry.rs b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -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
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -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
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -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;