[Updated] D8878: mergeresult: add sort argument to getactions() method

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Aug 8 16:55:49 UTC 2020


Closed by commit rHG27c6518b7287: mergeresult: add sort argument to getactions() method (authored by pulkit).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8878?vs=22259&id=22336

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8878/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8878

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -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



To: pulkit, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200808/8467d282/attachment-0002.html>


More information about the Mercurial-patches mailing list