Search code examples
mercurialmercurial-queue

Mercurial Queues: How to reorder patches efficiently


Suppose I have the follow patches in my mercurial queue:

$ hg qser -v
 0 A p1
 1 A p2
 2 A p3-StupidPatch
 3 A p4
 5 A p6
 ...
15 A p15

Now suppose that I want to do is reorder the patches so that p3-Stupid patch is the last patch. IE:

$ hg qser -v
 0 A p1
 1 A p2
 2 A p4
 3 A p6
 ...
14 A p15
15 A p3-StupidPatch

I know that I could do it like this:

$ # Pop patches until p2
$ hg qpop p2
$
$ hg qser -v
 0 A p1
 1 A p2
 2 U p3-StupidPatch
 3 U p4
 5 U p6
 ...
15 U p15
$
$ # Push patches one by one
$ hg qpush --move  p4
$ hg qpush --move p5
$ hg qpush --move p6
$ hg qpush --move p7
$ hg qpush --move p8
$ hg qpush --move p9
$ hg qpush --move p10
$ hg qpush --move p11
$ hg qpush --move p12
$ hg qpush --move p13
$ hg qpush --move p14
$ hg qpush --move p15
$ hg qpush --move p3-StupidPatch

Is there a better way to do this?


Solution

  • You can use hgtk log to reorder patches like this:

    enter image description here