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