dirstate: drop the from_p2_removed method
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 28 Sep 2021 20:00:19 +0200
changeset 48067 d3eb5f50052c
parent 48066 7a2de2bd9fcd
child 48068 bf8837e3d7ce
dirstate: drop the from_p2_removed method It it no longer in use. Differential Revision: https://phab.mercurial-scm.org/D11515
mercurial/cext/parsers.c
mercurial/pure/parsers.py
rust/hg-core/src/dirstate/entry.rs
rust/hg-cpython/src/dirstate/item.rs
--- a/mercurial/cext/parsers.c	Tue Sep 28 19:29:44 2021 +0200
+++ b/mercurial/cext/parsers.c	Tue Sep 28 20:00:19 2021 +0200
@@ -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 */
--- a/mercurial/pure/parsers.py	Tue Sep 28 19:29:44 2021 +0200
+++ b/mercurial/pure/parsers.py	Tue Sep 28 20:00:19 2021 +0200
@@ -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)
--- a/rust/hg-core/src/dirstate/entry.rs	Tue Sep 28 19:29:44 2021 +0200
+++ b/rust/hg-core/src/dirstate/entry.rs	Tue Sep 28 20:00:19 2021 +0200
@@ -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)
     }
--- a/rust/hg-cpython/src/dirstate/item.rs	Tue Sep 28 19:29:44 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/item.rs	Tue Sep 28 20:00:19 2021 +0200
@@ -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();