[Updated] D11601: dirstate-item: drop the legacy new_added constructor

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Sun Oct 3 21:38:03 UTC 2021


Closed by commit rHGb45c4dc65adc: dirstate-item: drop the legacy new_added constructor (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11601?vs=30606&id=30659

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

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

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
@@ -139,12 +139,6 @@
     }
 
     @classmethod
-    def new_added(_cls) -> PyResult<Self> {
-        let entry = DirstateEntry::new_added();
-        DirstateItem::create_instance(py, Cell::new(entry))
-    }
-
-    @classmethod
     def new_from_p2(_cls) -> PyResult<Self> {
         let entry = DirstateEntry::new_from_p2();
         DirstateItem::create_instance(py, Cell::new(entry))
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
@@ -125,14 +125,6 @@
         }
     }
 
-    pub fn new_added() -> Self {
-        Self {
-            flags: Flags::WDIR_TRACKED,
-            mode_size: None,
-            mtime: None,
-        }
-    }
-
     pub fn new_normal(mode: i32, size: i32, mtime: i32) -> Self {
         Self {
             flags: Flags::WDIR_TRACKED | Flags::P1_TRACKED,
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -109,14 +109,6 @@
             self._mtime = parentfiledata[2]
 
     @classmethod
-    def new_added(cls):
-        """constructor to help legacy API to build a new "added" item
-
-        Should eventually be removed
-        """
-        return cls(wc_tracked=True)
-
-    @classmethod
     def new_from_p2(cls):
         """constructor to help legacy API to build a new "from_p2" item
 
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -347,23 +347,6 @@
 	return (PyObject *)dirstate_item_from_v1_data(state, mode, size, mtime);
 };
 
-/* constructor to help legacy API to build a new "added" item
-
-Should eventually be removed */
-static PyObject *dirstate_item_new_added(PyTypeObject *subtype)
-{
-	dirstateItemObject *t;
-	t = (dirstateItemObject *)subtype->tp_alloc(subtype, 1);
-	if (!t) {
-		return NULL;
-	}
-	t->flags = dirstate_flag_wc_tracked;
-	t->mode = 0;
-	t->size = 0;
-	t->mtime = 0;
-	return (PyObject *)t;
-};
-
 /* constructor to help legacy API to build a new "from_p2" item
 
 Should eventually be removed */
@@ -492,9 +475,6 @@
      "True if the stored mtime would be ambiguous with the current time"},
     {"from_v1_data", (PyCFunction)dirstate_item_from_v1_meth,
      METH_VARARGS | METH_CLASS, "build a new DirstateItem object from V1 data"},
-    {"new_added", (PyCFunction)dirstate_item_new_added,
-     METH_NOARGS | METH_CLASS,
-     "constructor to help legacy API to build a new \"added\" item"},
     {"new_from_p2", (PyCFunction)dirstate_item_new_from_p2,
      METH_NOARGS | METH_CLASS,
      "constructor to help legacy API to build a new \"from_p2\" item"},



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/20211003/734efe16/attachment-0002.html>


More information about the Mercurial-patches mailing list