Show More
@@ -565,14 +565,14 b' class mergeresult(object):' | |||||
565 | deleted on one side and renamed on other. |
|
565 | deleted on one side and renamed on other. | |
566 | commitinfo: dict containing data which should be used on commit |
|
566 | commitinfo: dict containing data which should be used on commit | |
567 | contains a filename -> info mapping |
|
567 | contains a filename -> info mapping | |
568 |
actionmapping: dict of action names as keys and |
|
568 | actionmapping: dict of action names as keys and values are dict of | |
569 | related data as values |
|
569 | filename as key and related data as values | |
570 | """ |
|
570 | """ | |
571 | self._filemapping = {} |
|
571 | self._filemapping = {} | |
572 | self._diverge = {} |
|
572 | self._diverge = {} | |
573 | self._renamedelete = {} |
|
573 | self._renamedelete = {} | |
574 | self._commitinfo = {} |
|
574 | self._commitinfo = {} | |
575 |
self._actionmapping = collections.defaultdict( |
|
575 | self._actionmapping = collections.defaultdict(dict) | |
576 |
|
576 | |||
577 | def updatevalues(self, diverge, renamedelete, commitinfo): |
|
577 | def updatevalues(self, diverge, renamedelete, commitinfo): | |
578 | self._diverge = diverge |
|
578 | self._diverge = diverge | |
@@ -590,20 +590,18 b' class mergeresult(object):' | |||||
590 | # if the file already existed, we need to delete it's old |
|
590 | # if the file already existed, we need to delete it's old | |
591 | # entry form _actionmapping too |
|
591 | # entry form _actionmapping too | |
592 | if filename in self._filemapping: |
|
592 | if filename in self._filemapping: | |
593 | # TODO: this is inefficient |
|
|||
594 | a, d, m = self._filemapping[filename] |
|
593 | a, d, m = self._filemapping[filename] | |
595 |
self._actionmapping[a] |
|
594 | del self._actionmapping[a][filename] | |
596 |
|
595 | |||
597 | self._filemapping[filename] = (action, data, message) |
|
596 | self._filemapping[filename] = (action, data, message) | |
598 |
self._actionmapping[action] |
|
597 | self._actionmapping[action][filename] = (data, message) | |
599 |
|
598 | |||
600 | def removefile(self, filename): |
|
599 | def removefile(self, filename): | |
601 | """ removes a file from the mergeresult object as the file might |
|
600 | """ removes a file from the mergeresult object as the file might | |
602 | not merging anymore """ |
|
601 | not merging anymore """ | |
603 | action, data, message = self._filemapping[filename] |
|
602 | action, data, message = self._filemapping[filename] | |
604 | del self._filemapping[filename] |
|
603 | del self._filemapping[filename] | |
605 | # TODO: this is inefficient |
|
604 | del self._actionmapping[action][filename] | |
606 | self._actionmapping[action].remove((filename, data, message)) |
|
|||
607 |
|
605 | |||
608 | def getactions(self, actions): |
|
606 | def getactions(self, actions): | |
609 | """ get list of files which are marked with these actions |
|
607 | """ get list of files which are marked with these actions | |
@@ -612,7 +610,8 b' class mergeresult(object):' | |||||
612 | """ |
|
610 | """ | |
613 | res = [] |
|
611 | res = [] | |
614 | for a in actions: |
|
612 | for a in actions: | |
615 |
|
|
613 | for f, (args, msg) in pycompat.iteritems(self._actionmapping[a]): | |
|
614 | res.append((f, args, msg)) | |||
616 | return res |
|
615 | return res | |
617 |
|
616 | |||
618 | @property |
|
617 | @property | |
@@ -635,13 +634,17 b' class mergeresult(object):' | |||||
635 | def actionsdict(self): |
|
634 | def actionsdict(self): | |
636 | """ returns a dictionary of actions to be perfomed with action as key |
|
635 | """ returns a dictionary of actions to be perfomed with action as key | |
637 | and a list of files and related arguments as values """ |
|
636 | and a list of files and related arguments as values """ | |
638 | return self._actionmapping |
|
637 | res = emptyactions() | |
|
638 | for a, d in pycompat.iteritems(self._actionmapping): | |||
|
639 | for f, (args, msg) in pycompat.iteritems(d): | |||
|
640 | res[a].append((f, args, msg)) | |||
|
641 | return res | |||
639 |
|
642 | |||
640 | def setactions(self, actions): |
|
643 | def setactions(self, actions): | |
641 | self._filemapping = actions |
|
644 | self._filemapping = actions | |
642 |
self._actionmapping = collections.defaultdict( |
|
645 | self._actionmapping = collections.defaultdict(dict) | |
643 | for f, (act, data, msg) in pycompat.iteritems(self._filemapping): |
|
646 | for f, (act, data, msg) in pycompat.iteritems(self._filemapping): | |
644 |
self._actionmapping[act] |
|
647 | self._actionmapping[act][f] = data, msg | |
645 |
|
648 | |||
646 | def updateactions(self, updates): |
|
649 | def updateactions(self, updates): | |
647 | for f, (a, data, msg) in pycompat.iteritems(updates): |
|
650 | for f, (a, data, msg) in pycompat.iteritems(updates): |
General Comments 0
You need to be logged in to leave comments.
Login now