Angel Ezquerra  committed a7f6c5e

graft: sort graft source revisions from lowest to highest revision number (fixes #2159)

The graft dialog is able to graft multiple revisions, and is able to graft them
in a different order compared to their original order (since this is supported
by the mercurial graft command itself).

However, the graft dialog is usually called by selecting multiple revisions on
the repowidget. Unfortunately Qt does not always respect the order in which
the items where selected on the repowidget, which makes the behavior of the
graft dialog inconsistent.

To solve this issue, the repowidget will sort (from lowest to highest revision
number) the source revisions before passing them to the graft dialog. Doing the
sorting on the repowidget makes it possible to call the stand alone graft dialog
with an unsorted list of revisions, which does work.

  • Participants
  • Parent commits 169f56b
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/

     def graftRevisions(self):
         """Graft selected revision on top of working directory parent"""
         revlist = []
-        for rev in self.repoview.selectedRevisions():
+        for rev in sorted(self.repoview.selectedRevisions()):
         if not revlist:
             revlist = [self.rev]