Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do when you have too many changes within a single patch in an hg mq the patch queue?

The purpose of the hg mq plugin is to be able to make perfect commits to your repository, not confusing the changes that you made in your absent-minded ADHD induced rambling through your code;

For instance....

I'm working on bug x when I notice bug y and start working on it instead. At this point you are supposed to create a new patch in the patch queue so as not to confuse the changes when it is hg qfinish committed to your repository.

Now suppose for a minute that you forget make the new patch and in the process hg qrefresh. Then later realizing your mistake you wish to separate the changes from that one patch into two patches.

I realize that it has to do with editing your patch file (and a new patch file) in the queue to separate the changes into separate patches and later commits. However, I'm not yet skilled at editing the diff patch files.

Where can I learn about this? And how might one go about this?

like image 876
leeand00 Avatar asked Mar 24 '11 13:03

leeand00


3 Answers

Another option (assuming it runs on your platform) is version 2.0 of TortoiseHG. The 'inappropriately' named Shelve utility allows for moving of chunks and files between patches, or into the working directory. It's available for Windows, Linux and possibly OSX.

http://tortoisehg.bitbucket.io/

like image 179
Mikezx6r Avatar answered Oct 20 '22 08:10

Mikezx6r


As noted in this related SO question, check out the "Split a patch into multiple patches" section of the MQ tutorial.

like image 39
Tim Henigan Avatar answered Oct 20 '22 08:10

Tim Henigan


You can activate the record extension, adding to .hgrc the following lines:

[extensions]
hgext.record =

You can clear your current patch with

hg qrefresh nothing

(note that the "nothing" is just a random string: the arguments to qrefresh is the list of files which must be included in the current patch, so anything that is not the name of a modified file will do - I usually use "0")

Now with hg qrecord <patchName> you can choose interactively which changes must go in the new patch. The remaining changes can then be added to another patch with qnew or another qrecord. You can finally use qpop, qfold or edit .hg/patches/series to merge and reorder the patches.

like image 39
Aldo Avatar answered Oct 20 '22 10:10

Aldo