[Updated] D11515: dirstate: drop the from_p2_removed method

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Sep 30 08:32:42 UTC 2021


marmoute updated this revision to Diff 30444.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11515?vs=30438&id=30444

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11515/new/

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

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

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/item.rs b/rust/hg-cpython/src/dirstate/item.rs
--- a/rust/hg-cpython/src/dirstate/item.rs
+++ b/rust/hg-cpython/src/dirstate/item.rs
@@ -85,11 +85,6 @@
         Ok(self.entry(py).get().from_p2())
     }
 
-    @property
-    def from_p2_removed(&self) -> PyResult<bool> {
-        Ok(self.entry(py).get().from_p2_removed())
-    }
-
     def v1_state(&self) -> PyResult<PyBytes> {
         let (state, _mode, _size, _mtime) = self.entry(py).get().v1_data();
         let state_byte: u8 = state.into();
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
@@ -178,10 +178,6 @@
             && !self.flags.contains(Flags::WDIR_TRACKED)
     }
 
-    pub fn from_p2_removed(&self) -> bool {
-        self.removed() && self.flags.contains(Flags::CLEAN_P2)
-    }
-
     pub fn merged(&self) -> bool {
         self.flags.contains(Flags::WDIR_TRACKED | Flags::MERGED)
     }
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -339,15 +339,6 @@
         return self._clean_p2
 
     @property
-    def from_p2_removed(self):
-        """True if the file has been removed, but was "from_p2" initially
-
-        This property seems like an abstraction leakage and should probably be
-        dealt in this class (or maybe the dirstatemap) directly.
-        """
-        return self.removed and self._clean_p2
-
-    @property
     def removed(self):
         """True if the file has been removed"""
         return not self._wc_tracked and (self._p1_tracked or self._p2_tracked)
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -174,14 +174,6 @@
 	return (self->flags & dirstate_flag_clean_p2);
 }
 
-static inline bool dirstate_item_c_from_p2_removed(dirstateItemObject *self)
-{
-	if (!dirstate_item_c_removed(self)) {
-		return false;
-	}
-	return (self->flags & dirstate_flag_clean_p2);
-}
-
 static inline char dirstate_item_c_v1_state(dirstateItemObject *self)
 {
 	if (dirstate_item_c_removed(self)) {
@@ -628,15 +620,6 @@
 	}
 };
 
-static PyObject *dirstate_item_get_from_p2_removed(dirstateItemObject *self)
-{
-	if (dirstate_item_c_from_p2_removed(self)) {
-		Py_RETURN_TRUE;
-	} else {
-		Py_RETURN_FALSE;
-	}
-};
-
 static PyObject *dirstate_item_get_removed(dirstateItemObject *self)
 {
 	if (dirstate_item_c_removed(self)) {
@@ -654,8 +637,6 @@
     {"tracked", (getter)dirstate_item_get_tracked, NULL, "tracked", NULL},
     {"added", (getter)dirstate_item_get_added, NULL, "added", NULL},
     {"merged", (getter)dirstate_item_get_merged, NULL, "merged", NULL},
-    {"from_p2_removed", (getter)dirstate_item_get_from_p2_removed, NULL,
-     "from_p2_removed", NULL},
     {"from_p2", (getter)dirstate_item_get_from_p2, NULL, "from_p2", NULL},
     {"removed", (getter)dirstate_item_get_removed, NULL, "removed", NULL},
     {NULL} /* Sentinel */



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210930/c3c47e0e/attachment-0002.html>


More information about the Mercurial-patches mailing list