##// 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 int mtime_s;
66 int mtime_s;
67 int mtime_ns;
67 int mtime_ns;
68 PyObject *parentfiledata;
68 PyObject *parentfiledata;
69 PyObject *mtime;
69 PyObject *fallback_exec;
70 PyObject *fallback_exec;
70 PyObject *fallback_symlink;
71 PyObject *fallback_symlink;
71 static char *keywords_name[] = {
72 static char *keywords_name[] = {
@@ -118,10 +119,18 b' static PyObject *dirstate_item_new(PyTyp'
118 }
119 }
119
120
120 if (parentfiledata != Py_None) {
121 if (parentfiledata != Py_None) {
121 if (!PyArg_ParseTuple(parentfiledata, "ii(ii)", &mode, &size,
122 if (!PyArg_ParseTuple(parentfiledata, "iiO", &mode, &size,
122 &mtime_s, &mtime_ns)) {
123 &mtime)) {
123 return NULL;
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 } else {
134 } else {
126 has_meaningful_data = 0;
135 has_meaningful_data = 0;
127 has_meaningful_mtime = 0;
136 has_meaningful_mtime = 0;
@@ -475,10 +484,19 b' static PyObject *dirstate_item_set_clean'
475 PyObject *args)
484 PyObject *args)
476 {
485 {
477 int size, mode, mtime_s, mtime_ns;
486 int size, mode, mtime_s, mtime_ns;
478 if (!PyArg_ParseTuple(args, "ii(ii)", &mode, &size, &mtime_s,
487 PyObject *mtime;
479 &mtime_ns)) {
488 mtime_s = 0;
489 mtime_ns = 0;
490 if (!PyArg_ParseTuple(args, "iiO", &mode, &size, &mtime)) {
480 return NULL;
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 self->flags = dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
500 self->flags = dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
483 dirstate_flag_has_meaningful_data |
501 dirstate_flag_has_meaningful_data |
484 dirstate_flag_has_mtime;
502 dirstate_flag_has_mtime;
@@ -611,6 +611,7 b' class dirstate(object):'
611 )
611 )
612 if (
612 if (
613 parentfiledata is not None
613 parentfiledata is not None
614 and parentfiledata[2] is not None
614 and parentfiledata[2] > self._lastnormaltime
615 and parentfiledata[2] > self._lastnormaltime
615 ):
616 ):
616 # Remember the most recent modification timeslot for status(),
617 # Remember the most recent modification timeslot for status(),
@@ -130,6 +130,8 b' class DirstateItem(object):'
130 if parentfiledata is None:
130 if parentfiledata is None:
131 has_meaningful_mtime = False
131 has_meaningful_mtime = False
132 has_meaningful_data = False
132 has_meaningful_data = False
133 elif parentfiledata[2] is None:
134 has_meaningful_mtime = False
133 if has_meaningful_data:
135 if has_meaningful_data:
134 self._mode = parentfiledata[0]
136 self._mode = parentfiledata[0]
135 self._size = parentfiledata[1]
137 self._size = parentfiledata[1]
@@ -23,7 +23,7 b' py_class!(pub class DirstateItem |py| {'
23 p2_info: bool = false,
23 p2_info: bool = false,
24 has_meaningful_data: bool = true,
24 has_meaningful_data: bool = true,
25 has_meaningful_mtime: bool = true,
25 has_meaningful_mtime: bool = true,
26 parentfiledata: Option<(u32, u32, (u32, u32))> = None,
26 parentfiledata: Option<(u32, u32, Option<(u32, u32)>)> = None,
27 fallback_exec: Option<bool> = None,
27 fallback_exec: Option<bool> = None,
28 fallback_symlink: Option<bool> = None,
28 fallback_symlink: Option<bool> = None,
29
29
@@ -35,7 +35,9 b' py_class!(pub class DirstateItem |py| {'
35 mode_size_opt = Some((mode, size))
35 mode_size_opt = Some((mode, size))
36 }
36 }
37 if has_meaningful_mtime {
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 let entry = DirstateEntry::from_v2_data(
43 let entry = DirstateEntry::from_v2_data(
General Comments 0
You need to be logged in to leave comments. Login now