1. TortoiseHg
  2. TortoiseHg
  3. thg
  4. Issues
Issue #2159 resolved

graft a range of changesets ==> order is reversed

Anonymous created an issue

As a regular user of the transplant extension, I read about graft and tried it. But with graft, the sequence of changesets ends up in reversed order for me. thg version: TortoiseHg Dialogs (version 2.4.3), Mercurial (version 2.3.1)

Comments (6)

  1. Angel Ezquerra

    The new graft dialog grafts the selected changesets in the order that the user _selects_ them. That is, if you first click on changeset 14 and then shift+click on changeset 20, changesets 14 to 20 will be selected _in that order_. If you then call the graft dialog you'll se the changesets in that order as well and clicking on graft will graft those changesets in that order as well.

    If, on the other hand, you first click on changeset 20 and then shift+click on changeset 14, the first selected changeset will be 20, followed by 19 and so on down to 14. If you graft them you'll see them in that order on the graft dialog and they will be grafted in that order as well.

    Note that this is exactly the same behavior as the command line mercurial graft command.

    I can see how this can be confusing or unexpected though. Perhaps we could check the changeset order, and if the selected changesets are not sorted from the one with the lowest revision number to the one with the highest we could issue a warning.

    In the meantime, since this works as designed, I'm changing the issue priority and type.

  2. Ken Allen

    In Tortoise 2.5 ctrl-clicking sets up the graft in the order selected, but shift-clicking puts them in reverse order no matter which one you select first. Even if I ctrl click some, then shift-ctrl click a range, the range will always show up in reverse order though the range itself will be in order with the ctrl clicked ones.

  3. Angel Ezquerra

    That is true. It does work sometimes though (i.e. some times shift+clicking does preserve the order, but most of the time it doesn't). I do not know yet why this happens.

  4. Yuya Nishihara

    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.


  5. Log in to comment