equal
deleted
inserted
replaced
591 def setparents(self, p1, p2, fold_p2=False): |
591 def setparents(self, p1, p2, fold_p2=False): |
592 self._parents = (p1, p2) |
592 self._parents = (p1, p2) |
593 self._dirtyparents = True |
593 self._dirtyparents = True |
594 copies = {} |
594 copies = {} |
595 if fold_p2: |
595 if fold_p2: |
596 # Collect into an intermediate list to avoid a `RuntimeError` |
596 copies = self._map.setparents_fixup() |
597 # exception due to mutation during iteration. |
|
598 # TODO: move this the whole loop to Rust where `iter_mut` |
|
599 # enables in-place mutation of elements of a collection while |
|
600 # iterating it, without mutating the collection itself. |
|
601 files_with_p2_info = [ |
|
602 f for f, s in self._map.items() if s.p2_info |
|
603 ] |
|
604 rust_map = self._map |
|
605 for f in files_with_p2_info: |
|
606 e = rust_map.get(f) |
|
607 source = self.copymap.pop(f, None) |
|
608 if source: |
|
609 copies[f] = source |
|
610 e.drop_merge_data() |
|
611 rust_map.set_dirstate_item(f, e) |
|
612 return copies |
597 return copies |
613 |
598 |
614 ### disk interaction |
599 ### disk interaction |
615 |
600 |
616 @propertycache |
601 @propertycache |