From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30190 invoked by alias); 3 Feb 2009 11:12:50 -0000 Received: (qmail 30181 invoked by uid 22791); 3 Feb 2009 11:12:50 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44 X-Spam-Check-By: sourceware.org Received: from metis.ext.pengutronix.de (HELO metis.ext.pengutronix.de) (92.198.50.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Feb 2009 11:12:43 +0000 Received: from [2001:6f8:1178:2:221:70ff:fe71:1890] (helo=localhost) by metis.ext.pengutronix.de with esmtp (Exim 4.63) (envelope-from ) id 1LUJCp-0007Wu-IU for patchutils-list@sourceware.org; Tue, 03 Feb 2009 12:12:39 +0100 Date: Tue, 03 Feb 2009 11:12:00 -0000 From: Wolfram Sang To: patchutils-list@sourceware.org Subject: [patch v2] splitdiff: add option to extract the whole tree of subdiffs Message-ID: <20090203111239.GE3071@pengutronix.de> References: <20090202221217.790916412@pengutronix.de> <20090202221522.584037252@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YkJPYEFdoxh/AXLE" Content-Disposition: inline In-Reply-To: <20090202221522.584037252@pengutronix.de> User-Agent: Mutt/1.5.18 (2008-05-17) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:221:70ff:fe71:1890 X-SA-Exim-Mail-From: w.sang@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: patchutils-list@sourceware.org Mailing-List: contact patchutils-list-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: patchutils-list-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00002.txt.bz2 --YkJPYEFdoxh/AXLE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2438 Sometimes I get a huge patch blob (a couple of MB) which touches several fi= les all over a base directory (in this case the linux kernel tree). This new op= tion to splitdiff creates the path for every subdiff inside the blob and extract= s it to there. So, in the end, you get a directory tree you are familiar with and can easily find the small diffs which are of interest to you. Also, useful = for grepping in certain parts of the tree. Signed-off-by: Wolfram Sang --- Changes since V1: - make it a p1-patch - add '\n' to help-test Stupid mistakes, sorry for the noise. splitdiff.in | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) Index: splitdiff.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- a/splitdiff.in.orig +++ b/splitdiff.in @@ -18,7 +18,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =20 use Getopt::Std; -getopts('p:v-:ad', \%opts); +use File::Basename; +use File::Path; + +getopts('p:v-:adt', \%opts); if ($opts{'-'} && $opts{'-'} eq 'version') { print "splitdiff - patchutils version @VERSION@\n"; exit 0; @@ -29,6 +32,7 @@ if ($opts{'-'} && $opts{'-'} eq 'help')=20 print " -a split out every single file-level patch\n"; print " -p N pathname components to ignore\n"; print " -d use output filenames like a_b.c for a/b.c\n"; + print " -t create the whole tree of subdiffs (selects -a= , drops -d)\n"; exit 0; } =20 @@ -44,6 +48,10 @@ sub process { if ($opts{d}) { $out =3D $_[2]; $out =3D~ s,/,_,g; + } elsif ($opts{t}) { + my (undef, $dir) =3D fileparse($_[2]); + mkpath $dir; + $out =3D "$_[2].diff"; } else { $out =3D sprintf ("%s.part%03d", $ARGV[0], $part); } @@ -66,6 +74,12 @@ if($#ARGV !=3D 0) { $getlist =3D 'lsdiff -n '; $getlist .=3D '--strip=3D'.$opts{p}.' ' if ($opts{p}); $getlist .=3D $ARGV[0]; # Yuck. How do you do this properly in perl? + +if ($opts{t}) { + $opts{a} =3D 1; + undef $opts{d}; +} + open(LIST, '-|', $getlist) or die "Can't run lsdiff"; @list =3D ; close LIST; --=20 Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de Pengutronix - Linux Solutions for Science and Industry --YkJPYEFdoxh/AXLE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline Content-length: 197 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkmIJqcACgkQD27XaX1/VRvkOwCgzF8ej4Xmlc+jzjCkYC/tBcsc G+kAoJrFKGUo3NfHXplxLyQUpmdd82ob =SLa9 -----END PGP SIGNATURE----- --YkJPYEFdoxh/AXLE--