1

This is what I did :

hg init
hg qnew -m "p1" p1.patch
; some changes
hg qrefresh
hg qpop
hg qnew -m "p2" p2.patch
; some changes
hg qrefresh
hg qpop

Now those 2 patches were separate features and have nothing to do with each other. They need to be independent of each other.

Now I do (because I want only the 1st feature)

hg qpush p1.patch

It says :

applying p2.patch
applying p1.patch

and it gives me both the changes I made !

Am I doing something wrong?

It pushes other patches also when I tell it to push a specific patch.

batman
  • 5,022
  • 11
  • 52
  • 82

1 Answers1

4

You forgot one thing: set of MQ-patches is queue (FIFO queue). I.e if you can see more than one patch in hg qseries, you have to remember - qpush|qpop will apply|unapply patches not in random order, but in sequential order: push from bottom to top, pop in reverse order

Random access (and changing order of patches in a series as side effect) is --move option for qpush. In your case (using only one patch at a time) and patches names

  • hg qpop -a
  • hg qpush --move p1.patch
  • hg qpop -a
  • hg qpush --move p2.patch

In order to avoid mistakes you can redefine qpush (for this repository) in aliases section for always use --move option

planetmaker
  • 5,884
  • 3
  • 28
  • 37
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Although, I don't see why HG does it this way. What difference does popping do if all the patches in sequence are applied anyway? – batman Apr 26 '13 at 09:43
  • @learner - **not all** in my commands-set. Single pushed will be applied only (test it on toy-repo). I qpop all just due to own habits – Lazy Badger Apr 26 '13 at 13:04