diff mercurial/cext/parsers.c @ 47974:4e6f27230aee

dirstate: introduce a `set_clean` method on dirstate's map and items This method is the "reverse" of "set possibly dirty", and can be used to more accurately other call that the dirstate was making. It is currently heavily influenced by its origin. Differential Revision: https://phab.mercurial-scm.org/D11421
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 02 Sep 2021 03:59:35 +0200
parents 83f0e93ec34b
children ec178161a8d1
line wrap: on
line diff
--- a/mercurial/cext/parsers.c	Thu Sep 02 04:03:20 2021 +0200
+++ b/mercurial/cext/parsers.c	Thu Sep 02 03:59:35 2021 +0200
@@ -492,6 +492,21 @@
 	}
 }
 
+/* See docstring of the python implementation for details */
+static PyObject *dirstate_item_set_clean(dirstateItemObject *self,
+                                         PyObject *args)
+{
+	int size, mode, mtime;
+	if (!PyArg_ParseTuple(args, "iii", &mode, &size, &mtime)) {
+		return NULL;
+	}
+	self->flags = dirstate_flag_wc_tracked | dirstate_flag_p1_tracked;
+	self->mode = mode;
+	self->size = size;
+	self->mtime = mtime;
+	Py_RETURN_NONE;
+}
+
 static PyObject *dirstate_item_set_untracked(dirstateItemObject *self)
 {
 	self->flags &= ~dirstate_flag_wc_tracked;
@@ -531,6 +546,8 @@
      "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,
+     "mark a file as \"clean\""},
     {"set_untracked", (PyCFunction)dirstate_item_set_untracked, METH_NOARGS,
      "mark a file as \"untracked\""},
     {NULL} /* Sentinel */