Move lines from hunk to new patch (hg)

ratcliffe_mike March 4, 2014

I am using SourceTree to try to break a large patch into smaller patches so that they are easier to review.

Hunks may contain content that should be split into other patches so ideally I would be able to highlight a few lines from a hunk and somehow mark them for moving into a new patch.

Is there any way to move lines from one patch into a new / other patch?

This is for a Mercurial repository on OSX.

1 answer

0 votes
ratcliffe_mike March 5, 2014

Seems like this is not possible in SourceTree but there is a Mercurial extension that allows per hunk and per line cherry picking. At first I was put off by the fact that it has a text only interface but when I tried it I was surprised by the fact that it was so pleasant to use.

crecord is available from http://bitbucket.org/edgimar/crecord/get/tip.zip... unzip it somewhere, chmod +x * in that folder and add it to your extensions section:

[extensions]
crecord = path/to/crecord/

To use it:

$ hg qref -X .     # take changes out of current patch and back into `hg diff`
$ hg qcrecord -m "Did something!" new-patch-name.patch

The text interface is easy to use, navigate using the cursor keys and select things using space.

It would certainly be nice to be able to do this inside SourceTree though.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events