File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 39
39
$sourcedir =~ m # (.*)/([^/]+)-([\d +])$ # ;
40
40
my $rootdir = $1 ;
41
41
my $specname = $2 ;
42
- my $speclevel = $3 ;
42
+ my $sourcelevel = $3 ;
43
43
my @failed = ();
44
44
45
45
# 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 " ;
47
47
chdir $rootdir ;
48
48
$_ = ` ls -d $specname -*` ;
49
49
my @dirlist = split ;
50
50
print " Matching specs: @dirlist \n " ;
51
51
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 " ;
53
54
$_ = <STDIN >;
54
55
chomp ;
55
- exit if ($_ );
56
+ exit if ($_ && $_ == undef ); # abort if any value other than a number
57
+ my $minlevel = $_ || $sourcelevel ;
56
58
57
59
# main patching loop
58
60
foreach (@dirlist ) {
59
61
/ (\d +)$ / ;
60
62
my $level = $1 ;
61
- if ($level > $speclevel ) {
63
+ if (( $level >= $minlevel ) && ( $level != $sourcelevel ) ) {
62
64
print " \n Patching $_ ...\n " ;
63
65
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 $? ;
66
68
chdir $rootdir ;
67
69
}
68
70
}
81
83
}
82
84
}
83
85
else {
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 " ;
85
87
}
You can’t perform that action at this time.
0 commit comments