0

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.)

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127

2 Answers2

0
$ 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.

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
  • FYI: after `hg qpop -a` you could `hg qpush a-lot --move` instead of editing the series file and then just `hg qfinish a-lot` it. – Edward Mar 19 '15 at 15:40
0
  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.

John Jefferies
  • 1,176
  • 7
  • 13
  • Yes, it worked. The downside is that Ubuntu Precise uses hg 2.0.2 (and the built-in shelve is there starting from 2.8), so one has to clone the old shelve source as suggested at http://mercurial.selenic.com/wiki/ThirdPartyShelveExtension and checkout a compatible revision. Just enabling the shelve did not work, the reason described in http://stackoverflow.com/questions/22031147/hg-shelve-installed-but-hg-unknown-command-unshelve – 18446744073709551615 Mar 23 '15 at 13:16
  • You can get a newer repo for 3.01 using a ppa from [here](https://launchpad.net/~mercurial-ppa/+archive/ubuntu/releases). Also tortoise from [here](https://launchpad.net/~tortoisehg-ppa/+archive/ubuntu/releases). – John Jefferies Mar 23 '15 at 17:57