git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* splitting large patch files into smaller ones
@ 2007-08-22 19:29 Erez Zadok
  2007-08-22 21:54 ` René Scharfe
  2007-08-23  9:43 ` Johannes Schindelin
  0 siblings, 2 replies; 3+ messages in thread
From: Erez Zadok @ 2007-08-22 19:29 UTC (permalink / raw)
  To: git

I recently had an occasion to take a rather large git-diff patch, and split
it into smaller chunks.  This was so I can more easily import the patches
into guilt, then reorder, rename, shuffle, and join individual patch
snippets into logical patches (i.e., one patch per topic).

I was looking around for a tool that would allow me to split a large patch
file into individual snippets and couldn't find one.  So I wrote one in
perl.  It takes a patch file and creates individual small files, one for
each combination of a filename listed in the patch, and a patch snippet
(starting with an '@@' line).  Each '@@' snippet gets an index number and a
new filename, prefixed with the appropriate header ("diff ...", ---, and +++
lines) so it's a valid patch file on its own.

Questions:

1. Does anyone know of such a tool, perhaps written in C for better speed?

2. If not, is there any interest in such a tool?  If there's interest, I'd
   be happy to cleanup my perl script and contribute it to
   git/guilt/whatever.

Cheers,
Erez.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: splitting large patch files into smaller ones
  2007-08-22 19:29 splitting large patch files into smaller ones Erez Zadok
@ 2007-08-22 21:54 ` René Scharfe
  2007-08-23  9:43 ` Johannes Schindelin
  1 sibling, 0 replies; 3+ messages in thread
From: René Scharfe @ 2007-08-22 21:54 UTC (permalink / raw)
  To: Erez Zadok; +Cc: git

Erez Zadok schrieb:
> I recently had an occasion to take a rather large git-diff patch, and split
> it into smaller chunks.  This was so I can more easily import the patches
> into guilt, then reorder, rename, shuffle, and join individual patch
> snippets into logical patches (i.e., one patch per topic).
> 
> I was looking around for a tool that would allow me to split a large patch
> file into individual snippets and couldn't find one.  So I wrote one in
> perl.  It takes a patch file and creates individual small files, one for
> each combination of a filename listed in the patch, and a patch snippet
> (starting with an '@@' line).  Each '@@' snippet gets an index number and a
> new filename, prefixed with the appropriate header ("diff ...", ---, and +++
> lines) so it's a valid patch file on its own.
> 
> Questions:
> 
> 1. Does anyone know of such a tool, perhaps written in C for better speed?

The patchutils collection[1] contains a tool called splitdiff, which
does something slightly different[2].  It might be a good starting
point, though.

René


[1] http://cyberelk.net/tim/software/patchutils/?page_id=10
[2] http://cyberelk.net/tim/patchutils/man/splitdiff.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: splitting large patch files into smaller ones
  2007-08-22 19:29 splitting large patch files into smaller ones Erez Zadok
  2007-08-22 21:54 ` René Scharfe
@ 2007-08-23  9:43 ` Johannes Schindelin
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2007-08-23  9:43 UTC (permalink / raw)
  To: Erez Zadok; +Cc: git

Hi,

On Wed, 22 Aug 2007, Erez Zadok wrote:

> I was looking around for a tool that would allow me to split a large 
> patch file into individual snippets and couldn't find one.  So I wrote 
> one in perl.  It takes a patch file and creates individual small files, 
> one for each combination of a filename listed in the patch, and a patch 
> snippet (starting with an '@@' line).  Each '@@' snippet gets an index 
> number and a new filename, prefixed with the appropriate header ("diff 
> ...", ---, and +++ lines) so it's a valid patch file on its own.

You can do that with "git add -i" and with "git gui" AFAIK.  I even 
started some code to split hunks in "git gui", but it was pointed out that 
that code was not complete, and I did not have time to finish it.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-23  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-22 19:29 splitting large patch files into smaller ones Erez Zadok
2007-08-22 21:54 ` René Scharfe
2007-08-23  9:43 ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).