Question

I've read Steve Losh's article about using MQ's qqueues command to create multiple queues. This has the potential to get me closer to my personal take on Nirvana (namely, Git local branches), because I can keep changes related to separate features isolated from one another, I can roll the local changes into a single patch for release upstream, and I can delete the queues when I'm done with them. Awesome. Except I can't get it to work. I create the first queue using hg qqueue -c feature1, apply a patch to it using qrefresh, and then try to create a new queue. When I do I get an error:

~/src/mqtest$ hgl
@  55ae767d5eae  Adding feature1file  2013-04-29 15:32 -0500 Jon Blackburn default addFeature1file qbase qtip tip
|
o  58b232e9b36a  Initial commit on default.  2013-04-29 15:27 -0500 Jon Blackburn default qparent

~/src/mqtest$ hg qapplied 
addFeature1file
~/src/mqtest$ hg qq
feature1 (active)
patches
~/src/mqtest$ hg qq -c feature2
abort: new queue created, but cannot make active as patches are applied
~/src/mqtest$ 

What am I doing wrong?

Thanks.

P.S. @Lazy Badger indicated some skepticism about whether I need to pop -a in order to change queues. I'll say first that it's the only thing I've found that works. Also, from mq.py:

def _setactive(name):
    if q.applied:
    raise util.Abort(_('new queue created, but cannot make active '
                           'as patches are applied'))
    _setactivenocheck(name)

If there's a more appropriate way to switch to a new queue while I've got patches applied to the one I'm on, I'd love to hear it. With this solution the workflow would be 1) pop -a; 2) qqueue feature2; 3) optionally, push -a (if feature2 has some patches already). It's not clear to me why mq requires that no patches be applied to the queue you're leaving. I can't come up with a scenario in my head where that's useful. If my existing queue must be empty for me to leave it, then perhaps offer a flag to tell mq to pop -a my current queue (and push -a my target queue)?

Was it helpful?

Solution

You have one patch from feature1 applied, thus - qqueue can't switch to second queue after it's creation. From hg help qqueue

To create a new queue, use -c/--create. The queue is automatically made active, except in the case where there are applied patches from the currently active queue in the repository.

You have to:

  • unapply patch before creating new queue

or

  • switch to created queue by hand
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top