Return to Video

Moving and folding patches in your patch queue

  • 0:00 - 0:04
    We previously covered splitting a patch file into 2 separate patches.
  • 0:04 - 0:08
    In this video, we'll do the opposite, we'll show how to combine 2 patches into a single patch file.
  • 0:08 - 0:11
    I'll also show you how to move files in your patch queue.
  • 0:11 - 0:18
    So if you look here I setup 4 patches, you can see them here 1.diff, 2.diff, 3.diff, and 4.diff.
  • 0:18 - 0:22
    And each one of these patches, just contains a single added text file.
  • 0:22 - 0:28
    1.txt, 2.txt, 3.txt, and 4.txt respectively.
  • 0:28 - 0:33
    So if I just open up 1.diff just to show you, you can see that it has a single file 1.txt
  • 0:33 - 0:36
    and that file just says hi
  • 0:36 - 0:44
    And same thing for 2.diff, it says hi2. And it has 2.txt.
  • 0:44 - 0:48
    And same thing for 3 and 4.
  • 0:48 - 0:50
    So right now I have all 4 patches applied.
  • 0:50 - 0:52
    I'm just going to go and unapply all of them except for 1.diff
  • 0:52 - 0:56
    And you can see that it popped 4, 3, and 2.
  • 0:56 - 0:59
    And we're now at 1.diff.
  • 0:59 - 1:02
    And now let's say we wanted both 1.txt and 2.txt inside the same patch file.
  • 1:02 - 1:07
    Then what you can do is you can do hg qfold, and type 2.diff
  • 1:07 - 1:10
    And remember right now, only 1.diff is applied.
  • 1:10 - 1:12
    OK so that folded, so now when I go hg qapplied.
  • 1:12 - 1:16
    You'll see that 1.diff is the only one that is applied just like before.
  • 1:16 - 1:22
    But if I go hg qseries, you'll see that there's only 1.diff which is applied,
  • 1:22 - 1:25
    and 3 and 4.diff are not applied
  • 1:25 - 1:27
    And there's no 2.diff.
  • 1:27 - 1:34
    And that's because if I look inside 1.diff, you'll see that it has both those files.
  • 1:34 - 1:38
    Now another thing you can do, is you can actually fold a patch that's not in sequence.
  • 1:38 - 1:43
    So for example if I wanted to fold 4.diff inside 1.diff, I can do that.
  • 1:43 - 1:49
    I just do hg qfold 4.diff, and again only 1.diff is applied right now.
  • 1:49 - 1:57
    And when I go look at that file, 1.diff, you'll see now that it has 1.txt, 2.txt, and 4.txt in it.
  • 1:57 - 2:02
    Quit.
  • 2:02 - 2:05
    And if I look at my series now.
  • 2:05 - 2:07
    You'll see that I only have 1 and 3.
  • 2:07 - 2:10
    1 contains 1.txt, 2.txt, and 4.txt.
  • 2:10 - 2:13
    And 3 just contains 3.txt.
  • 2:13 - 2:18
    Now another useful thing you can do, is you can actually move around files in your patch queue.
  • 2:18 - 2:20
    So I'm just going to pop everything.
  • 2:20 - 2:23
    And let's say we wanted just 3.diff to appear before 1.diff.
  • 2:23 - 2:30
    We can do that with hg qpush --move and just type the name of the patch 3.diff
  • 2:30 - 2:34
    And that will actually apply that patch, and move it as the next patch.
  • 2:34 - 2:38
    So now when I do hg qseries, you'll see that 3 appears right now, and it's applied.
  • 2:38 - 2:41
    And 1.diff comes after that.
  • 2:41 - 2:44
    So both folding and moving patches should come up a lot as you work.
  • 2:44 - 2:49
    And hg qfold and hg qpush --move will help you do those things.
Title:
Moving and folding patches in your patch queue
Description:

How to reorder and fold patches in your patch queue with mercurial patch queues.

Help us caption & translate this video!

http://amara.org/v/DRhp/

more » « less
Video Language:
English
Duration:
02:50

English subtitles

Revisions