Patchwork D11608: dirstate-item: drop the legacy new_normal constructor

login
register
mail settings
Submitter phabricator
Date Oct. 3, 2021, 10:54 a.m.
Message ID <differential-rev-PHID-DREV-3e5dodzqdwa4cn533df3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49932/
State Superseded
Headers show

Comments

phabricator - Oct. 3, 2021, 10:54 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Nobody is calling it anymore. Its purposes has been filled.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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
@@ -138,12 +138,6 @@ 
         DirstateItem::create_instance(py, Cell::new(entry))
     }
 
-    @classmethod
-    def new_normal(_cls, mode: i32, size: i32, mtime: i32) -> PyResult<Self> {
-        let entry = DirstateEntry::new_normal(mode, size, mtime);
-        DirstateItem::create_instance(py, Cell::new(entry))
-    }
-
     def drop_merge_data(&self) -> PyResult<PyNone> {
         self.update(py, |entry| entry.drop_merge_data());
         Ok(PyNone)
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
@@ -121,14 +121,6 @@ 
         }
     }
 
-    pub fn new_normal(mode: i32, size: i32, mtime: i32) -> Self {
-        Self {
-            flags: Flags::WDIR_TRACKED | Flags::P1_TRACKED,
-            mode_size: Some((mode, size)),
-            mtime: Some(mtime),
-        }
-    }
-
     /// Creates a new entry in "removed" state.
     ///
     /// `size` is expected to be zero, `SIZE_NON_NORMAL`, or
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -109,20 +109,6 @@ 
             self._mtime = parentfiledata[2]
 
     @classmethod
-    def new_normal(cls, mode, size, mtime):
-        """constructor to help legacy API to build a new "normal" item
-
-        Should eventually be removed
-        """
-        assert size != FROM_P2
-        assert size != NONNORMAL
-        return cls(
-            wc_tracked=True,
-            p1_tracked=True,
-            parentfiledata=(mode, size, mtime),
-        )
-
-    @classmethod
     def from_v1_data(cls, state, mode, size, mtime):
         """Build a new DirstateItem object from V1 data
 
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -347,30 +347,6 @@ 
 	return (PyObject *)dirstate_item_from_v1_data(state, mode, size, mtime);
 };
 
-/* constructor to help legacy API to build a new "normal" item
-
-Should eventually be removed */
-static PyObject *dirstate_item_new_normal(PyTypeObject *subtype, PyObject *args)
-{
-	/* We do all the initialization here and not a tp_init function because
-	 * dirstate_item is immutable. */
-	dirstateItemObject *t;
-	int size, mode, mtime;
-	if (!PyArg_ParseTuple(args, "iii", &mode, &size, &mtime)) {
-		return NULL;
-	}
-
-	t = (dirstateItemObject *)subtype->tp_alloc(subtype, 1);
-	if (!t) {
-		return NULL;
-	}
-	t->flags = (dirstate_flag_wc_tracked | dirstate_flag_p1_tracked);
-	t->mode = mode;
-	t->size = size;
-	t->mtime = mtime;
-	return (PyObject *)t;
-};
-
 /* This means the next status call will have to actually check its content
    to make sure it is correct. */
 static PyObject *dirstate_item_set_possibly_dirty(dirstateItemObject *self)
@@ -437,9 +413,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_normal", (PyCFunction)dirstate_item_new_normal,
-     METH_VARARGS | METH_CLASS,
-     "constructor to help legacy API to build a new \"normal\" item"},
     {"set_possibly_dirty", (PyCFunction)dirstate_item_set_possibly_dirty,
      METH_NOARGS, "mark a file as \"possibly dirty\""},
     {"set_clean", (PyCFunction)dirstate_item_set_clean, METH_VARARGS,