##// END OF EJS Templates
dirstate-item: add a `set_possibly_dirty` method...
marmoute -
r48466:e53256a9 default
parent child Browse files
Show More
@@ -31,6 +31,7 b' static const char *const versionerrortex'
31 31
32 32 static const int dirstate_v1_from_p2 = -2;
33 33 static const int dirstate_v1_nonnormal = -1;
34 static const int ambiguous_time = -1;
34 35
35 36 static PyObject *dict_new_presized(PyObject *self, PyObject *args)
36 37 {
@@ -197,6 +198,14 b' static PyObject *dirstate_item_from_v1_m'
197 198 return (PyObject *)t;
198 199 };
199 200
201 /* This means the next status call will have to actually check its content
202 to make sure it is correct. */
203 static PyObject *dirstate_item_set_possibly_dirty(dirstateItemObject *self)
204 {
205 self->mtime = ambiguous_time;
206 Py_RETURN_NONE;
207 }
208
200 209 static PyMethodDef dirstate_item_methods[] = {
201 210 {"v1_state", (PyCFunction)dirstate_item_v1_state, METH_NOARGS,
202 211 "return a \"state\" suitable for v1 serialization"},
@@ -210,6 +219,8 b' static PyMethodDef dirstate_item_methods'
210 219 "True if the stored mtime would be ambiguous with the current time"},
211 220 {"from_v1_data", (PyCFunction)dirstate_item_from_v1_meth, METH_O,
212 221 "build a new DirstateItem object from V1 data"},
222 {"set_possibly_dirty", (PyCFunction)dirstate_item_set_possibly_dirty,
223 METH_NOARGS, "mark a file as \"possibly dirty\""},
213 224 {NULL} /* Sentinel */
214 225 };
215 226
@@ -81,6 +81,14 b' class DirstateItem(object):'
81 81 mtime=mtime,
82 82 )
83 83
84 def set_possibly_dirty(self):
85 """Mark a file as "possibly dirty"
86
87 This means the next status call will have to actually check its content
88 to make sure it is correct.
89 """
90 self._mtime = AMBIGUOUS_TIME
91
84 92 def __getitem__(self, idx):
85 93 if idx == 0 or idx == -4:
86 94 msg = b"do not use item[x], use item.state"
General Comments 0
You need to be logged in to leave comments. Login now