Mercurial Queues: cannot commit and cannot qpop

674 Views Asked by At

I have added some debugging stuff to an existing working code and made a mq patch. (The debugging stuff in fact breaks the application, but I need it to debug the features that I add, this is why I want to have one unit responsible for the changes, a patch would be ok.) Then I have modified the working code, and now I want to commit what I have done. The idea is to commit the changes but not the debugging stuff.

But it did not work:

$ hg ci
abort: cannot commit over an applied mq patch
$ hg qpop
abort: local changes found, refresh first
$ hg qseries
debug-stuff
$ hg qapplied
debug-stuff

How do I temporarily unapply the debugging changes and commit the useful changes? (Then I will need to reapply the debugging changes and continue development.)

2

There are 2 best solutions below

2
John Jefferies On BEST ANSWER
  1. "hg shelve" to save your uncommitted work
  2. qpop the patch
  3. "hg unshelve" to restore your feature

then you can commit the feature.

1
18446744073709551615 On
$ hg qnew -f a-lot
$ hg qpop -a
// manually editing .hg/patches/series to swap the two patches
$ hg qpush

and now I have the changes as a mq patch, while I want to commit them.

$ hg qapplied
a-lot
$ hg qfinish a-lot
patch a-lot finalized without changeset message
$ hg qapplied
$

Now 'hg log' shows the changes as committed.

I still wonder if qfinish would do the job without extra manipulations.