Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top