Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 45336:27c6518b7287
mergeresult: add sort argument to getactions() method
This will be used in next patch.
Differential Revision: https://phab.mercurial-scm.org/D8878
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 03 Aug 2020 14:54:45 +0530 |
parents | 2c96fd8e05f6 |
children | 5ce63ee1fe3d |
comparison
equal
deleted
inserted
replaced
45335:2c96fd8e05f6 | 45336:27c6518b7287 |
---|---|
602 not merging anymore """ | 602 not merging anymore """ |
603 action, data, message = self._filemapping[filename] | 603 action, data, message = self._filemapping[filename] |
604 del self._filemapping[filename] | 604 del self._filemapping[filename] |
605 del self._actionmapping[action][filename] | 605 del self._actionmapping[action][filename] |
606 | 606 |
607 def getactions(self, actions): | 607 def getactions(self, actions, sort=False): |
608 """ get list of files which are marked with these actions | 608 """ get list of files which are marked with these actions |
609 if sort is true, files for each action is sorted and then added | |
609 | 610 |
610 Returns a list of tuple of form (filename, data, message) | 611 Returns a list of tuple of form (filename, data, message) |
611 """ | 612 """ |
612 res = [] | 613 res = [] |
613 for a in actions: | 614 for a in actions: |
614 for f, (args, msg) in pycompat.iteritems(self._actionmapping[a]): | 615 if sort: |
615 res.append((f, args, msg)) | 616 for f in sorted(self._actionmapping[a]): |
617 args, msg = self._actionmapping[a][f] | |
618 res.append((f, args, msg)) | |
619 else: | |
620 for f, (args, msg) in pycompat.iteritems( | |
621 self._actionmapping[a] | |
622 ): | |
623 res.append((f, args, msg)) | |
616 return res | 624 return res |
617 | 625 |
618 @property | 626 @property |
619 def actions(self): | 627 def actions(self): |
620 return self._filemapping | 628 return self._filemapping |