Move lines from hunk to new patch (hg)

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

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 unzip it somewhere, chmod +x * in that folder and add it to your extensions section:

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
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,230 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you