Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

split a hunk in hg; change tolerance

Tags:

mercurial

I use the hunk-by-hunk or hunk selection approach to committing: instead of commuting all changes I made to a file, I commit related parts. E.g. I wrote a function and a test, compiled to ensure it works and then commit the function and the test separately. For this I use built-in functionality in tortoiseHg and RecordExtention when in the console.

Now I have two edits separated by only one unchanged line, thus falling in hg's tolerance of one hunk. I want to commit only the former for now. How?

like image 801
Valerij Avatar asked Sep 13 '13 15:09

Valerij


1 Answers

The record extension doesn't let you split hunks further, but the less-standard CRecord extension does.

Just to put it out there, but what you're doing is usually considered bad practice because it guarantees that you haven't run the unit tests on the files as they're being committed. That, of course, doesn't apply in all environments.

If the reason you're leaving some parts uncommitted is because they're local-only changes you always in in place (passwords, paths, etc.) they're a good candidate for a Mercurial Queues "patch". Then you'd be able to 'pop' them off, commit the whole file, and then 'push' them back on.

like image 60
Ry4an Brase Avatar answered Oct 19 '22 15:10

Ry4an Brase