##// END OF EJS Templates
dirstate: move parent state handling in the dirstatemap...
marmoute -
r48873:5d68c4ee default
parent child Browse files
Show More
@@ -381,39 +381,10 b' class dirstate(object):'
381 oldp2 = self._pl[1]
381 oldp2 = self._pl[1]
382 if self._origpl is None:
382 if self._origpl is None:
383 self._origpl = self._pl
383 self._origpl = self._pl
384 self._map.setparents(p1, p2)
385 copies = {}
386 nullid = self._nodeconstants.nullid
384 nullid = self._nodeconstants.nullid
387 if oldp2 != nullid and p2 == nullid:
385 # True if we need to fold p2 related state back to a linear case
388 candidatefiles = self._map.non_normal_or_other_parent_paths()
386 fold_p2 = oldp2 != nullid and p2 == nullid
389
387 return self._map.setparents(p1, p2, fold_p2=fold_p2)
390 for f in candidatefiles:
391 s = self._map.get(f)
392 if s is None:
393 continue
394
395 # Discard "merged" markers when moving away from a merge state
396 if s.merged:
397 source = self._map.copymap.get(f)
398 if source:
399 copies[f] = source
400 self._map.reset_state(
401 f,
402 wc_tracked=True,
403 p1_tracked=True,
404 possibly_dirty=True,
405 )
406 # Also fix up otherparent markers
407 elif s.from_p2:
408 source = self._map.copymap.get(f)
409 if source:
410 copies[f] = source
411 self._map.reset_state(
412 f,
413 p1_tracked=False,
414 wc_tracked=True,
415 )
416 return copies
417
388
418 def setbranch(self, branch):
389 def setbranch(self, branch):
419 self.__class__._branch.set(self, encoding.fromlocal(branch))
390 self.__class__._branch.set(self, encoding.fromlocal(branch))
@@ -428,9 +428,40 b' class dirstatemap(object):'
428
428
429 return self._parents
429 return self._parents
430
430
431 def setparents(self, p1, p2):
431 def setparents(self, p1, p2, fold_p2=False):
432 self._parents = (p1, p2)
432 self._parents = (p1, p2)
433 self._dirtyparents = True
433 self._dirtyparents = True
434 copies = {}
435 if fold_p2:
436 candidatefiles = self.non_normal_or_other_parent_paths()
437
438 for f in candidatefiles:
439 s = self.get(f)
440 if s is None:
441 continue
442
443 # Discard "merged" markers when moving away from a merge state
444 if s.merged:
445 source = self.copymap.get(f)
446 if source:
447 copies[f] = source
448 self.reset_state(
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
434
465
435 def read(self):
466 def read(self):
436 # ignore HG_PENDING because identity is used only for writing
467 # ignore HG_PENDING because identity is used only for writing
@@ -769,9 +800,40 b' if rustmod is not None:'
769 # File doesn't exist, so the current state is empty
800 # File doesn't exist, so the current state is empty
770 return b''
801 return b''
771
802
772 def setparents(self, p1, p2):
803 def setparents(self, p1, p2, fold_p2=False):
773 self._parents = (p1, p2)
804 self._parents = (p1, p2)
774 self._dirtyparents = True
805 self._dirtyparents = True
806 copies = {}
807 if fold_p2:
808 candidatefiles = self.non_normal_or_other_parent_paths()
809
810 for f in candidatefiles:
811 s = self.get(f)
812 if s is None:
813 continue
814
815 # Discard "merged" markers when moving away from a merge state
816 if s.merged:
817 source = self.copymap.get(f)
818 if source:
819 copies[f] = source
820 self.reset_state(
821 f,
822 wc_tracked=True,
823 p1_tracked=True,
824 possibly_dirty=True,
825 )
826 # Also fix up otherparent markers
827 elif s.from_p2:
828 source = self.copymap.get(f)
829 if source:
830 copies[f] = source
831 self.reset_state(
832 f,
833 p1_tracked=False,
834 wc_tracked=True,
835 )
836 return copies
775
837
776 def parents(self):
838 def parents(self):
777 if not self._parents:
839 if not self._parents:
General Comments 0
You need to be logged in to leave comments. Login now