[Request] [+ ] D11514: dirstate: inline the `from_p2_removed` logic

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Sep 29 08:37:36 UTC 2021


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

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;



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210929/a3f66730/attachment-0001.html>


More information about the Mercurial-patches mailing list