# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1596446685 -19800 # Node ID 27c6518b7287c751490ae77cf6f6c3c2ddace1c8 # Parent 2c96fd8e05f6c2b612eab29b320c907f232c00c2 mergeresult: add sort argument to getactions() method This will be used in next patch. Differential Revision: https://phab.mercurial-scm.org/D8878 diff -r 2c96fd8e05f6 -r 27c6518b7287 mercurial/merge.py --- a/mercurial/merge.py Mon Aug 03 14:19:06 2020 +0530 +++ b/mercurial/merge.py Mon Aug 03 14:54:45 2020 +0530 @@ -604,15 +604,23 @@ del self._filemapping[filename] del self._actionmapping[action][filename] - def getactions(self, actions): + def getactions(self, actions, sort=False): """ get list of files which are marked with these actions + if sort is true, files for each action is sorted and then added Returns a list of tuple of form (filename, data, message) """ res = [] for a in actions: - for f, (args, msg) in pycompat.iteritems(self._actionmapping[a]): - res.append((f, args, msg)) + if sort: + for f in sorted(self._actionmapping[a]): + args, msg = self._actionmapping[a][f] + res.append((f, args, msg)) + else: + for f, (args, msg) in pycompat.iteritems( + self._actionmapping[a] + ): + res.append((f, args, msg)) return res @property