Show More
@@ -152,24 +152,80 b' static void dirstate_item_dealloc(PyObje' | |||
|
152 | 152 | PyObject_Del(o); |
|
153 | 153 | } |
|
154 | 154 | |
|
155 | static inline bool dirstate_item_c_tracked(dirstateItemObject *self) | |
|
156 | { | |
|
157 | return (self->state == 'a' || self->state == 'm' || self->state == 'n'); | |
|
158 | } | |
|
159 | ||
|
160 | static inline bool dirstate_item_c_added(dirstateItemObject *self) | |
|
161 | { | |
|
162 | return (self->state == 'a'); | |
|
163 | } | |
|
164 | ||
|
165 | static inline bool dirstate_item_c_removed(dirstateItemObject *self) | |
|
166 | { | |
|
167 | return (self->state == 'r'); | |
|
168 | } | |
|
169 | ||
|
170 | static inline bool dirstate_item_c_merged(dirstateItemObject *self) | |
|
171 | { | |
|
172 | return (self->state == 'm'); | |
|
173 | } | |
|
174 | ||
|
175 | static inline bool dirstate_item_c_merged_removed(dirstateItemObject *self) | |
|
176 | { | |
|
177 | return (self->state == 'r' && self->size == dirstate_v1_nonnormal); | |
|
178 | } | |
|
179 | ||
|
180 | static inline bool dirstate_item_c_from_p2(dirstateItemObject *self) | |
|
181 | { | |
|
182 | return (self->state == 'n' && self->size == dirstate_v1_from_p2); | |
|
183 | } | |
|
184 | ||
|
185 | static inline bool dirstate_item_c_from_p2_removed(dirstateItemObject *self) | |
|
186 | { | |
|
187 | return (self->state == 'r' && self->size == dirstate_v1_from_p2); | |
|
188 | } | |
|
189 | ||
|
190 | static inline char dirstate_item_c_v1_state(dirstateItemObject *self) | |
|
191 | { | |
|
192 | return self->state; | |
|
193 | } | |
|
194 | ||
|
195 | static inline int dirstate_item_c_v1_mode(dirstateItemObject *self) | |
|
196 | { | |
|
197 | return self->mode; | |
|
198 | } | |
|
199 | ||
|
200 | static inline int dirstate_item_c_v1_size(dirstateItemObject *self) | |
|
201 | { | |
|
202 | return self->size; | |
|
203 | } | |
|
204 | ||
|
205 | static inline int dirstate_item_c_v1_mtime(dirstateItemObject *self) | |
|
206 | { | |
|
207 | return self->mtime; | |
|
208 | } | |
|
209 | ||
|
155 | 210 | static PyObject *dirstate_item_v1_state(dirstateItemObject *self) |
|
156 | 211 | { |
|
157 | return PyBytes_FromStringAndSize(&self->state, 1); | |
|
212 | char state = dirstate_item_c_v1_state(self); | |
|
213 | return PyBytes_FromStringAndSize(&state, 1); | |
|
158 | 214 | }; |
|
159 | 215 | |
|
160 | 216 | static PyObject *dirstate_item_v1_mode(dirstateItemObject *self) |
|
161 | 217 | { |
|
162 |
return PyInt_FromLong(self |
|
|
218 | return PyInt_FromLong(dirstate_item_c_v1_mode(self)); | |
|
163 | 219 | }; |
|
164 | 220 | |
|
165 | 221 | static PyObject *dirstate_item_v1_size(dirstateItemObject *self) |
|
166 | 222 | { |
|
167 |
return PyInt_FromLong(self |
|
|
223 | return PyInt_FromLong(dirstate_item_c_v1_size(self)); | |
|
168 | 224 | }; |
|
169 | 225 | |
|
170 | 226 | static PyObject *dirstate_item_v1_mtime(dirstateItemObject *self) |
|
171 | 227 | { |
|
172 |
return PyInt_FromLong(self |
|
|
228 | return PyInt_FromLong(dirstate_item_c_v1_mtime(self)); | |
|
173 | 229 | }; |
|
174 | 230 | |
|
175 | 231 | static PyObject *dirstate_item_need_delay(dirstateItemObject *self, |
@@ -179,7 +235,8 b' static PyObject *dirstate_item_need_dela' | |||
|
179 | 235 | if (!pylong_to_long(value, &now)) { |
|
180 | 236 | return NULL; |
|
181 | 237 | } |
|
182 | if (self->state == 'n' && self->mtime == now) { | |
|
238 | if (dirstate_item_c_v1_state(self) == 'n' && | |
|
239 | dirstate_item_c_v1_mtime(self) == now) { | |
|
183 | 240 | Py_RETURN_TRUE; |
|
184 | 241 | } else { |
|
185 | 242 | Py_RETURN_FALSE; |
@@ -373,27 +430,28 b' static PyMethodDef dirstate_item_methods' | |||
|
373 | 430 | |
|
374 | 431 | static PyObject *dirstate_item_get_mode(dirstateItemObject *self) |
|
375 | 432 | { |
|
376 |
return PyInt_FromLong(self |
|
|
433 | return PyInt_FromLong(dirstate_item_c_v1_mode(self)); | |
|
377 | 434 | }; |
|
378 | 435 | |
|
379 | 436 | static PyObject *dirstate_item_get_size(dirstateItemObject *self) |
|
380 | 437 | { |
|
381 |
return PyInt_FromLong(self |
|
|
438 | return PyInt_FromLong(dirstate_item_c_v1_size(self)); | |
|
382 | 439 | }; |
|
383 | 440 | |
|
384 | 441 | static PyObject *dirstate_item_get_mtime(dirstateItemObject *self) |
|
385 | 442 | { |
|
386 |
return PyInt_FromLong(self |
|
|
443 | return PyInt_FromLong(dirstate_item_c_v1_mtime(self)); | |
|
387 | 444 | }; |
|
388 | 445 | |
|
389 | 446 | static PyObject *dirstate_item_get_state(dirstateItemObject *self) |
|
390 | 447 | { |
|
391 | return PyBytes_FromStringAndSize(&self->state, 1); | |
|
448 | char state = dirstate_item_c_v1_state(self); | |
|
449 | return PyBytes_FromStringAndSize(&state, 1); | |
|
392 | 450 | }; |
|
393 | 451 | |
|
394 | 452 | static PyObject *dirstate_item_get_tracked(dirstateItemObject *self) |
|
395 | 453 | { |
|
396 | if (self->state == 'a' || self->state == 'm' || self->state == 'n') { | |
|
454 | if (dirstate_item_c_tracked(self)) { | |
|
397 | 455 | Py_RETURN_TRUE; |
|
398 | 456 | } else { |
|
399 | 457 | Py_RETURN_FALSE; |
@@ -402,7 +460,7 b' static PyObject *dirstate_item_get_track' | |||
|
402 | 460 | |
|
403 | 461 | static PyObject *dirstate_item_get_added(dirstateItemObject *self) |
|
404 | 462 | { |
|
405 | if (self->state == 'a') { | |
|
463 | if (dirstate_item_c_added(self)) { | |
|
406 | 464 | Py_RETURN_TRUE; |
|
407 | 465 | } else { |
|
408 | 466 | Py_RETURN_FALSE; |
@@ -411,7 +469,7 b' static PyObject *dirstate_item_get_added' | |||
|
411 | 469 | |
|
412 | 470 | static PyObject *dirstate_item_get_merged(dirstateItemObject *self) |
|
413 | 471 | { |
|
414 | if (self->state == 'm') { | |
|
472 | if (dirstate_item_c_merged(self)) { | |
|
415 | 473 | Py_RETURN_TRUE; |
|
416 | 474 | } else { |
|
417 | 475 | Py_RETURN_FALSE; |
@@ -420,7 +478,7 b' static PyObject *dirstate_item_get_merge' | |||
|
420 | 478 | |
|
421 | 479 | static PyObject *dirstate_item_get_merged_removed(dirstateItemObject *self) |
|
422 | 480 | { |
|
423 | if (self->state == 'r' && self->size == dirstate_v1_nonnormal) { | |
|
481 | if (dirstate_item_c_merged_removed(self)) { | |
|
424 | 482 | Py_RETURN_TRUE; |
|
425 | 483 | } else { |
|
426 | 484 | Py_RETURN_FALSE; |
@@ -429,7 +487,7 b' static PyObject *dirstate_item_get_merge' | |||
|
429 | 487 | |
|
430 | 488 | static PyObject *dirstate_item_get_from_p2(dirstateItemObject *self) |
|
431 | 489 | { |
|
432 | if (self->state == 'n' && self->size == dirstate_v1_from_p2) { | |
|
490 | if (dirstate_item_c_from_p2(self)) { | |
|
433 | 491 | Py_RETURN_TRUE; |
|
434 | 492 | } else { |
|
435 | 493 | Py_RETURN_FALSE; |
@@ -438,7 +496,7 b' static PyObject *dirstate_item_get_from_' | |||
|
438 | 496 | |
|
439 | 497 | static PyObject *dirstate_item_get_from_p2_removed(dirstateItemObject *self) |
|
440 | 498 | { |
|
441 | if (self->state == 'r' && self->size == dirstate_v1_from_p2) { | |
|
499 | if (dirstate_item_c_from_p2_removed(self)) { | |
|
442 | 500 | Py_RETURN_TRUE; |
|
443 | 501 | } else { |
|
444 | 502 | Py_RETURN_FALSE; |
@@ -447,7 +505,7 b' static PyObject *dirstate_item_get_from_' | |||
|
447 | 505 | |
|
448 | 506 | static PyObject *dirstate_item_get_removed(dirstateItemObject *self) |
|
449 | 507 | { |
|
450 | if (self->state == 'r') { | |
|
508 | if (dirstate_item_c_removed(self)) { | |
|
451 | 509 | Py_RETURN_TRUE; |
|
452 | 510 | } else { |
|
453 | 511 | Py_RETURN_FALSE; |
@@ -456,7 +514,8 b' static PyObject *dirstate_item_get_remov' | |||
|
456 | 514 | |
|
457 | 515 | static PyObject *dm_nonnormal(dirstateItemObject *self) |
|
458 | 516 | { |
|
459 | if (self->state != 'n' || self->mtime == ambiguous_time) { | |
|
517 | if ((dirstate_item_c_v1_state(self) != 'n') || | |
|
518 | (dirstate_item_c_v1_mtime(self) == ambiguous_time)) { | |
|
460 | 519 | Py_RETURN_TRUE; |
|
461 | 520 | } else { |
|
462 | 521 | Py_RETURN_FALSE; |
@@ -464,7 +523,7 b' static PyObject *dm_nonnormal(dirstateIt' | |||
|
464 | 523 | }; |
|
465 | 524 | static PyObject *dm_otherparent(dirstateItemObject *self) |
|
466 | 525 | { |
|
467 |
if (self |
|
|
526 | if (dirstate_item_c_v1_mtime(self) == dirstate_v1_from_p2) { | |
|
468 | 527 | Py_RETURN_TRUE; |
|
469 | 528 | } else { |
|
470 | 529 | Py_RETURN_FALSE; |
General Comments 0
You need to be logged in to leave comments.
Login now