mercurial/cext/parsers.c
changeset 48446 111098af6356
parent 48440 434de12918fd
child 48447 af303ae33cd7
equal deleted inserted replaced
48445:8d585aa9becf 48446:111098af6356
    59 	int wc_tracked;
    59 	int wc_tracked;
    60 	int p1_tracked;
    60 	int p1_tracked;
    61 	int p2_info;
    61 	int p2_info;
    62 	int has_meaningful_data;
    62 	int has_meaningful_data;
    63 	int has_meaningful_mtime;
    63 	int has_meaningful_mtime;
       
    64 	int mtime_second_ambiguous;
    64 	int mode;
    65 	int mode;
    65 	int size;
    66 	int size;
    66 	int mtime_s;
    67 	int mtime_s;
    67 	int mtime_ns;
    68 	int mtime_ns;
    68 	PyObject *parentfiledata;
    69 	PyObject *parentfiledata;
    77 	wc_tracked = 0;
    78 	wc_tracked = 0;
    78 	p1_tracked = 0;
    79 	p1_tracked = 0;
    79 	p2_info = 0;
    80 	p2_info = 0;
    80 	has_meaningful_mtime = 1;
    81 	has_meaningful_mtime = 1;
    81 	has_meaningful_data = 1;
    82 	has_meaningful_data = 1;
       
    83 	mtime_second_ambiguous = 0;
    82 	parentfiledata = Py_None;
    84 	parentfiledata = Py_None;
    83 	fallback_exec = Py_None;
    85 	fallback_exec = Py_None;
    84 	fallback_symlink = Py_None;
    86 	fallback_symlink = Py_None;
    85 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iiiiiOOO", keywords_name,
    87 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iiiiiOOO", keywords_name,
    86 	                                 &wc_tracked, &p1_tracked, &p2_info,
    88 	                                 &wc_tracked, &p1_tracked, &p2_info,
   122 		if (!PyArg_ParseTuple(parentfiledata, "iiO", &mode, &size,
   124 		if (!PyArg_ParseTuple(parentfiledata, "iiO", &mode, &size,
   123 		                      &mtime)) {
   125 		                      &mtime)) {
   124 			return NULL;
   126 			return NULL;
   125 		}
   127 		}
   126 		if (mtime != Py_None) {
   128 		if (mtime != Py_None) {
   127 			if (!PyArg_ParseTuple(mtime, "ii", &mtime_s,
   129 			if (!PyArg_ParseTuple(mtime, "iii", &mtime_s, &mtime_ns,
   128 			                      &mtime_ns)) {
   130 			                      &mtime_second_ambiguous)) {
   129 				return NULL;
   131 				return NULL;
   130 			}
   132 			}
   131 		} else {
   133 		} else {
   132 			has_meaningful_mtime = 0;
   134 			has_meaningful_mtime = 0;
   133 		}
   135 		}
   137 	}
   139 	}
   138 	if (has_meaningful_data) {
   140 	if (has_meaningful_data) {
   139 		t->flags |= dirstate_flag_has_meaningful_data;
   141 		t->flags |= dirstate_flag_has_meaningful_data;
   140 		t->mode = mode;
   142 		t->mode = mode;
   141 		t->size = size;
   143 		t->size = size;
       
   144 		if (mtime_second_ambiguous) {
       
   145 			t->flags |= dirstate_flag_mtime_second_ambiguous;
       
   146 		}
   142 	} else {
   147 	} else {
   143 		t->mode = 0;
   148 		t->mode = 0;
   144 		t->size = 0;
   149 		t->size = 0;
   145 	}
   150 	}
   146 	if (has_meaningful_mtime) {
   151 	if (has_meaningful_mtime) {
   323 static PyObject *dirstate_item_mtime_likely_equal_to(dirstateItemObject *self,
   328 static PyObject *dirstate_item_mtime_likely_equal_to(dirstateItemObject *self,
   324                                                      PyObject *other)
   329                                                      PyObject *other)
   325 {
   330 {
   326 	int other_s;
   331 	int other_s;
   327 	int other_ns;
   332 	int other_ns;
   328 	if (!PyArg_ParseTuple(other, "ii", &other_s, &other_ns)) {
   333 	int other_second_ambiguous;
       
   334 	if (!PyArg_ParseTuple(other, "iii", &other_s, &other_ns,
       
   335 	                      &other_second_ambiguous)) {
   329 		return NULL;
   336 		return NULL;
   330 	}
   337 	}
   331 	if ((self->flags & dirstate_flag_has_mtime) &&
   338 	if ((self->flags & dirstate_flag_has_mtime) &&
   332 	    self->mtime_s == other_s &&
   339 	    self->mtime_s == other_s &&
   333 	    (self->mtime_ns == other_ns || self->mtime_ns == 0 ||
   340 	    (self->mtime_ns == other_ns || self->mtime_ns == 0 ||
   466 
   473 
   467 /* See docstring of the python implementation for details */
   474 /* See docstring of the python implementation for details */
   468 static PyObject *dirstate_item_set_clean(dirstateItemObject *self,
   475 static PyObject *dirstate_item_set_clean(dirstateItemObject *self,
   469                                          PyObject *args)
   476                                          PyObject *args)
   470 {
   477 {
   471 	int size, mode, mtime_s, mtime_ns;
   478 	int size, mode, mtime_s, mtime_ns, mtime_second_ambiguous;
   472 	PyObject *mtime;
   479 	PyObject *mtime;
   473 	mtime_s = 0;
   480 	mtime_s = 0;
   474 	mtime_ns = 0;
   481 	mtime_ns = 0;
       
   482 	mtime_second_ambiguous = 0;
   475 	if (!PyArg_ParseTuple(args, "iiO", &mode, &size, &mtime)) {
   483 	if (!PyArg_ParseTuple(args, "iiO", &mode, &size, &mtime)) {
   476 		return NULL;
   484 		return NULL;
   477 	}
   485 	}
   478 	if (mtime != Py_None) {
   486 	if (mtime != Py_None) {
   479 		if (!PyArg_ParseTuple(mtime, "ii", &mtime_s, &mtime_ns)) {
   487 		if (!PyArg_ParseTuple(mtime, "iii", &mtime_s, &mtime_ns,
       
   488 		                      &mtime_second_ambiguous)) {
   480 			return NULL;
   489 			return NULL;
   481 		}
   490 		}
   482 	} else {
   491 	} else {
   483 		self->flags &= ~dirstate_flag_has_mtime;
   492 		self->flags &= ~dirstate_flag_has_mtime;
   484 	}
   493 	}
   485 	self->flags = dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
   494 	self->flags = dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
   486 	              dirstate_flag_has_meaningful_data |
   495 	              dirstate_flag_has_meaningful_data |
   487 	              dirstate_flag_has_mtime;
   496 	              dirstate_flag_has_mtime;
       
   497 	if (mtime_second_ambiguous) {
       
   498 		self->flags |= dirstate_flag_mtime_second_ambiguous;
       
   499 	}
   488 	self->mode = mode;
   500 	self->mode = mode;
   489 	self->size = size;
   501 	self->size = size;
   490 	self->mtime_s = mtime_s;
   502 	self->mtime_s = mtime_s;
   491 	self->mtime_ns = mtime_ns;
   503 	self->mtime_ns = mtime_ns;
   492 	Py_RETURN_NONE;
   504 	Py_RETURN_NONE;