555 It has information about what actions need to be performed on dirstate |
555 It has information about what actions need to be performed on dirstate |
556 mapping of divergent renames and other such cases. ''' |
556 mapping of divergent renames and other such cases. ''' |
557 |
557 |
558 def __init__(self): |
558 def __init__(self): |
559 """ |
559 """ |
560 actions: dict of filename as keys and action related info as values |
560 filemapping: dict of filename as keys and action related info as values |
561 diverge: mapping of source name -> list of dest name for |
561 diverge: mapping of source name -> list of dest name for |
562 divergent renames |
562 divergent renames |
563 renamedelete: mapping of source name -> list of destinations for files |
563 renamedelete: mapping of source name -> list of destinations for files |
564 deleted on one side and renamed on other. |
564 deleted on one side and renamed on other. |
565 commitinfo: dict containing data which should be used on commit |
565 commitinfo: dict containing data which should be used on commit |
566 contains a filename -> info mapping |
566 contains a filename -> info mapping |
567 """ |
567 """ |
568 self._actions = {} |
568 self._filemapping = {} |
569 self._diverge = {} |
569 self._diverge = {} |
570 self._renamedelete = {} |
570 self._renamedelete = {} |
571 self._commitinfo = {} |
571 self._commitinfo = {} |
572 |
572 |
573 def updatevalues(self, diverge, renamedelete, commitinfo): |
573 def updatevalues(self, diverge, renamedelete, commitinfo): |
581 filename: file which we are adding |
581 filename: file which we are adding |
582 action: one of mergestatemod.ACTION_* |
582 action: one of mergestatemod.ACTION_* |
583 data: a tuple of information like fctx and ctx related to this merge |
583 data: a tuple of information like fctx and ctx related to this merge |
584 message: a message about the merge |
584 message: a message about the merge |
585 """ |
585 """ |
586 self._actions[filename] = (action, data, message) |
586 self._filemapping[filename] = (action, data, message) |
587 |
587 |
588 def removefile(self, filename): |
588 def removefile(self, filename): |
589 """ removes a file from the mergeresult object as the file might |
589 """ removes a file from the mergeresult object as the file might |
590 not merging anymore """ |
590 not merging anymore """ |
591 del self._actions[filename] |
591 del self._filemapping[filename] |
592 |
592 |
593 @property |
593 @property |
594 def actions(self): |
594 def actions(self): |
595 return self._actions |
595 return self._filemapping |
596 |
596 |
597 @property |
597 @property |
598 def diverge(self): |
598 def diverge(self): |
599 return self._diverge |
599 return self._diverge |
600 |
600 |
610 def actionsdict(self): |
610 def actionsdict(self): |
611 """ returns a dictionary of actions to be perfomed with action as key |
611 """ returns a dictionary of actions to be perfomed with action as key |
612 and a list of files and related arguments as values """ |
612 and a list of files and related arguments as values """ |
613 # Convert to dictionary-of-lists format |
613 # Convert to dictionary-of-lists format |
614 actions = emptyactions() |
614 actions = emptyactions() |
615 for f, (m, args, msg) in pycompat.iteritems(self._actions): |
615 for f, (m, args, msg) in pycompat.iteritems(self._filemapping): |
616 if m not in actions: |
616 if m not in actions: |
617 actions[m] = [] |
617 actions[m] = [] |
618 actions[m].append((f, args, msg)) |
618 actions[m].append((f, args, msg)) |
619 |
619 |
620 return actions |
620 return actions |
621 |
621 |
622 def setactions(self, actions): |
622 def setactions(self, actions): |
623 self._actions = actions |
623 self._filemapping = actions |
624 |
624 |
625 def updateactions(self, updates): |
625 def updateactions(self, updates): |
626 self._actions.update(updates) |
626 self._filemapping.update(updates) |
627 |
627 |
628 def hasconflicts(self): |
628 def hasconflicts(self): |
629 """ tells whether this merge resulted in some actions which can |
629 """ tells whether this merge resulted in some actions which can |
630 result in conflicts or not """ |
630 result in conflicts or not """ |
631 for _f, (m, _unused, _unused) in pycompat.iteritems(self._actions): |
631 for _f, (m, _unused, _unused) in pycompat.iteritems(self._filemapping): |
632 if m not in ( |
632 if m not in ( |
633 mergestatemod.ACTION_GET, |
633 mergestatemod.ACTION_GET, |
634 mergestatemod.ACTION_KEEP, |
634 mergestatemod.ACTION_KEEP, |
635 mergestatemod.ACTION_EXEC, |
635 mergestatemod.ACTION_EXEC, |
636 mergestatemod.ACTION_REMOVE, |
636 mergestatemod.ACTION_REMOVE, |