Patchwork D11514: dirstate: inline the `from_p2_removed` logic

login
register
mail settings
Submitter phabricator
Date Sept. 29, 2021, 8:37 a.m.
Message ID <differential-rev-PHID-DREV-vrvcvmivnx2ykymvj3zf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49837/
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/D11514

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
@@ -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
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -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
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -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;