##// END OF EJS Templates
dirstate-item: drop the legacy new_normal constructor...
marmoute -
r48976:1ab4523a default
parent child Browse files
Show More
@@ -347,30 +347,6 b' static PyObject *dirstate_item_from_v1_m'
347 return (PyObject *)dirstate_item_from_v1_data(state, mode, size, mtime);
347 return (PyObject *)dirstate_item_from_v1_data(state, mode, size, mtime);
348 };
348 };
349
349
350 /* constructor to help legacy API to build a new "normal" item
351
352 Should eventually be removed */
353 static PyObject *dirstate_item_new_normal(PyTypeObject *subtype, PyObject *args)
354 {
355 /* We do all the initialization here and not a tp_init function because
356 * dirstate_item is immutable. */
357 dirstateItemObject *t;
358 int size, mode, mtime;
359 if (!PyArg_ParseTuple(args, "iii", &mode, &size, &mtime)) {
360 return NULL;
361 }
362
363 t = (dirstateItemObject *)subtype->tp_alloc(subtype, 1);
364 if (!t) {
365 return NULL;
366 }
367 t->flags = (dirstate_flag_wc_tracked | dirstate_flag_p1_tracked);
368 t->mode = mode;
369 t->size = size;
370 t->mtime = mtime;
371 return (PyObject *)t;
372 };
373
374 /* This means the next status call will have to actually check its content
350 /* This means the next status call will have to actually check its content
375 to make sure it is correct. */
351 to make sure it is correct. */
376 static PyObject *dirstate_item_set_possibly_dirty(dirstateItemObject *self)
352 static PyObject *dirstate_item_set_possibly_dirty(dirstateItemObject *self)
@@ -437,9 +413,6 b' static PyMethodDef dirstate_item_methods'
437 "True if the stored mtime would be ambiguous with the current time"},
413 "True if the stored mtime would be ambiguous with the current time"},
438 {"from_v1_data", (PyCFunction)dirstate_item_from_v1_meth,
414 {"from_v1_data", (PyCFunction)dirstate_item_from_v1_meth,
439 METH_VARARGS | METH_CLASS, "build a new DirstateItem object from V1 data"},
415 METH_VARARGS | METH_CLASS, "build a new DirstateItem object from V1 data"},
440 {"new_normal", (PyCFunction)dirstate_item_new_normal,
441 METH_VARARGS | METH_CLASS,
442 "constructor to help legacy API to build a new \"normal\" item"},
443 {"set_possibly_dirty", (PyCFunction)dirstate_item_set_possibly_dirty,
416 {"set_possibly_dirty", (PyCFunction)dirstate_item_set_possibly_dirty,
444 METH_NOARGS, "mark a file as \"possibly dirty\""},
417 METH_NOARGS, "mark a file as \"possibly dirty\""},
445 {"set_clean", (PyCFunction)dirstate_item_set_clean, METH_VARARGS,
418 {"set_clean", (PyCFunction)dirstate_item_set_clean, METH_VARARGS,
@@ -109,20 +109,6 b' class DirstateItem(object):'
109 self._mtime = parentfiledata[2]
109 self._mtime = parentfiledata[2]
110
110
111 @classmethod
111 @classmethod
112 def new_normal(cls, mode, size, mtime):
113 """constructor to help legacy API to build a new "normal" item
114
115 Should eventually be removed
116 """
117 assert size != FROM_P2
118 assert size != NONNORMAL
119 return cls(
120 wc_tracked=True,
121 p1_tracked=True,
122 parentfiledata=(mode, size, mtime),
123 )
124
125 @classmethod
126 def from_v1_data(cls, state, mode, size, mtime):
112 def from_v1_data(cls, state, mode, size, mtime):
127 """Build a new DirstateItem object from V1 data
113 """Build a new DirstateItem object from V1 data
128
114
@@ -121,14 +121,6 b' impl DirstateEntry {'
121 }
121 }
122 }
122 }
123
123
124 pub fn new_normal(mode: i32, size: i32, mtime: i32) -> Self {
125 Self {
126 flags: Flags::WDIR_TRACKED | Flags::P1_TRACKED,
127 mode_size: Some((mode, size)),
128 mtime: Some(mtime),
129 }
130 }
131
132 /// Creates a new entry in "removed" state.
124 /// Creates a new entry in "removed" state.
133 ///
125 ///
134 /// `size` is expected to be zero, `SIZE_NON_NORMAL`, or
126 /// `size` is expected to be zero, `SIZE_NON_NORMAL`, or
@@ -138,12 +138,6 b' py_class!(pub class DirstateItem |py| {'
138 DirstateItem::create_instance(py, Cell::new(entry))
138 DirstateItem::create_instance(py, Cell::new(entry))
139 }
139 }
140
140
141 @classmethod
142 def new_normal(_cls, mode: i32, size: i32, mtime: i32) -> PyResult<Self> {
143 let entry = DirstateEntry::new_normal(mode, size, mtime);
144 DirstateItem::create_instance(py, Cell::new(entry))
145 }
146
147 def drop_merge_data(&self) -> PyResult<PyNone> {
141 def drop_merge_data(&self) -> PyResult<PyNone> {
148 self.update(py, |entry| entry.drop_merge_data());
142 self.update(py, |entry| entry.drop_merge_data());
149 Ok(PyNone)
143 Ok(PyNone)
General Comments 0
You need to be logged in to leave comments. Login now