Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Sometimes I need to split a big patch into smaller (disjoint) ones, e.g. for every separate feature included.

Usually I do it via standard vim yank/dd commands and split-window switching.

But are there some tools/vim-tricks to help with such kind of editing?

For example support for commands like: move the 3 next complete hunks to right opened patch file

share|improve this question
    
You may want to also look on unix.stackexchange.com/questions/618/how-to-merge-patches –  Maciej Piechotka Oct 1 '10 at 16:40
1  
BTW, how come that people answer the question but do not find it useful/clear enough to up-vote it ?!? ;) –  maxschlepzig Oct 1 '10 at 17:06

4 Answers 4

Somewhat off-topic, I guess but I still think it's useful.

If you use git to do your development you can easily split your whole changes into smaller "hunks" that embody one feature each. You end up with one commit per feature and can use git's git-format-patch to create (and even sign and properly attribute) patches, I outlined how to do that here

share|improve this answer

You might want to take a look into patchutils [1]. For the vim part, I wrote a small vim plugin that helps with navigating in patches: diff_navigator [2].

[1] http://cyberelk.net/tim/software/patchutils/

[2] http://www.vim.org/scripts/script.php?script_id=2361

share|improve this answer
1  
The diff_navigator URL is apparently vim.org/scripts/script.php?script_id=2361 Emacs has similar features in the Ediff and SMerge modes –  Riccardo Murri Oct 1 '10 at 9:59
1  
Could you extend your answer to make it more comprehensive? Adding an example how to use what utility from the patchutils set to split a big patch into disjoint ones would be great ... –  maxschlepzig Aug 30 '11 at 20:05
    
+1 for the vim script –  Dror Cohen Jul 3 '12 at 12:57

You can use this to split the big patch to smaller chunks (either per file or every hunk) and then if you need to merge then use combinediff from the patchutils package that was mentioned in Petr Uzel's answer

share|improve this answer

My Suse has splitdiff util which works like this:

$ splitdiff -a tmp.179639.patch
Wrote >tmp.179639.patch.part001
Wrote >tmp.179639.patch.part002
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.