File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939$sourcedir =~ m # (.*)/([^/]+)-([\d +])$ # ;
4040my $rootdir = $1 ;
4141my $specname = $2 ;
42- my $speclevel = $3 ;
42+ my $sourcelevel = $3 ;
4343my @failed = ();
4444
4545# confirm before continuing
46- print " Sourcing diffs from $specname level $speclevel under root $rootdir :\n " ;
46+ print " Sourcing diffs from $specname level $sourcelevel under root $rootdir :\n " ;
4747chdir $rootdir ;
4848$_ = ` ls -d $specname -*` ;
4949my @dirlist = split ;
5050print " Matching specs: @dirlist \n " ;
5151
52- print " Press enter to continue, q to quit:" ;
52+ # ask what levels to patch
53+ print " Press enter to patch levels higher than $sourcelevel , q to quit, or an integer for a different lowest level to patch:\n " ;
5354$_ = <STDIN >;
5455chomp ;
55- exit if ($_ );
56+ exit if ($_ && $_ == undef ); # abort if any value other than a number
57+ my $minlevel = $_ || $sourcelevel ;
5658
5759# main patching loop
5860foreach (@dirlist ) {
5961 / (\d +)$ / ;
6062 my $level = $1 ;
61- if ($level > $speclevel ) {
63+ if (( $level >= $minlevel ) && ( $level != $sourcelevel ) ) {
6264 print " \n Patching $_ ...\n " ;
6365 chdir $_ ;
64- print ` git diff $sourcedir | patch -p2` ;
65- push @failed , $specname . ' -' . $speclevel if $? ;
66+ print ` git diff -U3 --minimal $sourcedir | patch -p2` ;
67+ push @failed , $specname . ' -' . $level if $? ;
6668 chdir $rootdir ;
6769 }
6870}
8183 }
8284}
8385else {
84- die " Patching failed for @failed , please fix and commit manually.\n " ;
86+ die " \n\n Patching failed for @failed , please fix and commit manually.\n " ;
8587}
You can’t perform that action at this time.
0 commit comments