##// END OF EJS Templates
dirstate-item: allow mtime to be None in "parentdata"...
marmoute -
r49201:3d6eb119 default
parent child Browse files
Show More
@@ -66,6 +66,7 b' static PyObject *dirstate_item_new(PyTyp'
66 66 int mtime_s;
67 67 int mtime_ns;
68 68 PyObject *parentfiledata;
69 PyObject *mtime;
69 70 PyObject *fallback_exec;
70 71 PyObject *fallback_symlink;
71 72 static char *keywords_name[] = {
@@ -118,10 +119,18 b' static PyObject *dirstate_item_new(PyTyp'
118 119 }
119 120
120 121 if (parentfiledata != Py_None) {
121 if (!PyArg_ParseTuple(parentfiledata, "ii(ii)", &mode, &size,
122 &mtime_s, &mtime_ns)) {
122 if (!PyArg_ParseTuple(parentfiledata, "iiO", &mode, &size,
123 &mtime)) {
123 124 return NULL;
124 125 }
126 if (mtime != Py_None) {
127 if (!PyArg_ParseTuple(mtime, "ii", &mtime_s,
128 &mtime_ns)) {
129 return NULL;
130 }
131 } else {
132 has_meaningful_mtime = 0;
133 }
125 134 } else {
126 135 has_meaningful_data = 0;
127 136 has_meaningful_mtime = 0;
@@ -475,10 +484,19 b' static PyObject *dirstate_item_set_clean'
475 484 PyObject *args)
476 485 {
477 486 int size, mode, mtime_s, mtime_ns;
478 if (!PyArg_ParseTuple(args, "ii(ii)", &mode, &size, &mtime_s,
479 &mtime_ns)) {
487 PyObject *mtime;
488 mtime_s = 0;
489 mtime_ns = 0;
490 if (!PyArg_ParseTuple(args, "iiO", &mode, &size, &mtime)) {
480 491 return NULL;
481 492 }
493 if (mtime != Py_None) {
494 if (!PyArg_ParseTuple(mtime, "ii", &mtime_s, &mtime_ns)) {
495 return NULL;
496 }
497 } else {
498 self->flags &= ~dirstate_flag_has_mtime;
499 }
482 500 self->flags = dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
483 501 dirstate_flag_has_meaningful_data |
484 502 dirstate_flag_has_mtime;
@@ -611,6 +611,7 b' class dirstate(object):'
611 611 )
612 612 if (
613 613 parentfiledata is not None
614 and parentfiledata[2] is not None
614 615 and parentfiledata[2] > self._lastnormaltime
615 616 ):
616 617 # Remember the most recent modification timeslot for status(),
@@ -130,6 +130,8 b' class DirstateItem(object):'
130 130 if parentfiledata is None:
131 131 has_meaningful_mtime = False
132 132 has_meaningful_data = False
133 elif parentfiledata[2] is None:
134 has_meaningful_mtime = False
133 135 if has_meaningful_data:
134 136 self._mode = parentfiledata[0]
135 137 self._size = parentfiledata[1]
@@ -23,7 +23,7 b' py_class!(pub class DirstateItem |py| {'
23 23 p2_info: bool = false,
24 24 has_meaningful_data: bool = true,
25 25 has_meaningful_mtime: bool = true,
26 parentfiledata: Option<(u32, u32, (u32, u32))> = None,
26 parentfiledata: Option<(u32, u32, Option<(u32, u32)>)> = None,
27 27 fallback_exec: Option<bool> = None,
28 28 fallback_symlink: Option<bool> = None,
29 29
@@ -35,7 +35,9 b' py_class!(pub class DirstateItem |py| {'
35 35 mode_size_opt = Some((mode, size))
36 36 }
37 37 if has_meaningful_mtime {
38 mtime_opt = Some(timestamp(py, mtime)?)
38 if let Some(m) = mtime {
39 mtime_opt = Some(timestamp(py, m)?);
40 }
39 41 }
40 42 }
41 43 let entry = DirstateEntry::from_v2_data(
General Comments 0
You need to be logged in to leave comments. Login now