##// END OF EJS Templates
dirstate: use a new `drop_merge_data` in `setparent`...
marmoute -
r48874:a660d8a5 default
parent child Browse files
Show More
@@ -515,6 +515,27 b' static PyObject *dirstate_item_set_untra'
515 Py_RETURN_NONE;
515 Py_RETURN_NONE;
516 }
516 }
517
517
518 static PyObject *dirstate_item_drop_merge_data(dirstateItemObject *self)
519 {
520 if (dirstate_item_c_merged(self) || dirstate_item_c_from_p2(self)) {
521 if (dirstate_item_c_merged(self)) {
522 self->flags |= dirstate_flag_p1_tracked;
523 } else {
524 self->flags &= ~dirstate_flag_p1_tracked;
525 }
526 self->flags &=
527 ~(dirstate_flag_merged | dirstate_flag_clean_p1 |
528 dirstate_flag_clean_p2 | dirstate_flag_p2_tracked);
529 self->flags |= dirstate_flag_possibly_dirty;
530 self->mode = 0;
531 self->mtime = 0;
532 /* size = None on the python size turn into size = NON_NORMAL
533 * when accessed. So the next line is currently required, but a
534 * some future clean up would be welcome. */
535 self->size = dirstate_v1_nonnormal;
536 }
537 Py_RETURN_NONE;
538 }
518 static PyMethodDef dirstate_item_methods[] = {
539 static PyMethodDef dirstate_item_methods[] = {
519 {"v1_state", (PyCFunction)dirstate_item_v1_state, METH_NOARGS,
540 {"v1_state", (PyCFunction)dirstate_item_v1_state, METH_NOARGS,
520 "return a \"state\" suitable for v1 serialization"},
541 "return a \"state\" suitable for v1 serialization"},
@@ -551,6 +572,8 b' static PyMethodDef dirstate_item_methods'
551 "mark a file as \"tracked\""},
572 "mark a file as \"tracked\""},
552 {"set_untracked", (PyCFunction)dirstate_item_set_untracked, METH_NOARGS,
573 {"set_untracked", (PyCFunction)dirstate_item_set_untracked, METH_NOARGS,
553 "mark a file as \"untracked\""},
574 "mark a file as \"untracked\""},
575 {"drop_merge_data", (PyCFunction)dirstate_item_drop_merge_data, METH_NOARGS,
576 "remove all \"merge-only\" from a DirstateItem"},
554 {NULL} /* Sentinel */
577 {NULL} /* Sentinel */
555 };
578 };
556
579
@@ -441,26 +441,11 b' class dirstatemap(object):'
441 continue
441 continue
442
442
443 # Discard "merged" markers when moving away from a merge state
443 # Discard "merged" markers when moving away from a merge state
444 if s.merged:
444 if s.merged or s.from_p2:
445 source = self.copymap.get(f)
445 source = self.copymap.pop(f, None)
446 if source:
446 if source:
447 copies[f] = source
447 copies[f] = source
448 self.reset_state(
448 s.drop_merge_data()
449 f,
450 wc_tracked=True,
451 p1_tracked=True,
452 possibly_dirty=True,
453 )
454 # Also fix up otherparent markers
455 elif s.from_p2:
456 source = self.copymap.get(f)
457 if source:
458 copies[f] = source
459 self.reset_state(
460 f,
461 p1_tracked=False,
462 wc_tracked=True,
463 )
464 return copies
449 return copies
465
450
466 def read(self):
451 def read(self):
@@ -263,6 +263,24 b' class DirstateItem(object):'
263 self._size = None
263 self._size = None
264 self._mtime = None
264 self._mtime = None
265
265
266 def drop_merge_data(self):
267 """remove all "merge-only" from a DirstateItem
268
269 This is to be call by the dirstatemap code when the second parent is dropped
270 """
271 if not (self.merged or self.from_p2):
272 return
273 self._p1_tracked = self.merged # why is this not already properly set ?
274
275 self._merged = False
276 self._clean_p1 = False
277 self._clean_p2 = False
278 self._p2_tracked = False
279 self._possibly_dirty = True
280 self._mode = None
281 self._size = None
282 self._mtime = None
283
266 @property
284 @property
267 def mode(self):
285 def mode(self):
268 return self.v1_mode()
286 return self.v1_mode()
General Comments 0
You need to be logged in to leave comments. Login now