Changeset 183030 in webkit
- Timestamp:
- Apr 20, 2015, 3:05:52 PM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r183029 r183030 1 2015-04-17 Matthew Hanson <matthew_hanson@apple.com> 2 3 prepare-ChangeLog should ignore the preceeding function when processing the removal of a function. 4 https://bugs.webkit.org/show_bug.cgi?id=143897 5 6 Reviewed by David Kilzer. 7 8 This is a speculative fix that addresses two issues: 9 10 1. An off-by-one error which allowed ending lines to be less than starting lines when a hunk was a pure delete. 11 We were determining ending lines from combined diffs using the logic: End = Start + Offset - 1. 12 13 So for a hunk like "@@ -723,10 +721,0 @@ bool foobar", we were generating the following starting/ending line pairs: 14 Before: (723, 729) 15 After: (721, 720) 16 17 Before is correct, but After should be (721, 721), since it represents the beginning and ending lines for the hunk. 18 Whether there are zero lines or one line in the hunk, the starting and ending line are the same. 19 20 This error was causing bad behavior on purely additive and purely subtractive hunks, but since we only refer 21 to After when generating ChangeLog output, the extractLineRangeBeforeChange had no visible effect on program output. 22 23 The fix is to set End to the max of Start + Offset - 1 and Start, rather than always using the former. 24 25 2. Creating git diffs from HEAD and not origin/master by default. 26 27 Hard-coding origin/master into the originalFile command has the disadvantage of causing the diff to fail entirely 28 when origin/master does not exist, and to do the wrong thing when determining deleted functions/methods. 29 30 * Scripts/prepare-ChangeLog: 31 (originalFile): 32 Use HEAD instead of origin/master in default Git case. 33 34 (generateFunctionLists): 35 Ensure that the end line is not less than the start line. 36 37 (extractLineRangeAfterChange): 38 Set the end line to the start line if the end line is less than the start line. 39 40 (extractLineRangeBeforeChange): 41 Ditto. 42 1 43 2015-04-17 Matthew Hanson <matthew_hanson@apple.com> 2 44 -
trunk/Tools/Scripts/prepare-ChangeLog
r183029 r183030 61 61 use Getopt::Long; 62 62 use lib $FindBin::Bin; 63 use List::Util qw/any /;63 use List::Util qw/any max/; 64 64 use POSIX qw(strftime); 65 65 use VCSUtils; … … 258 258 $command .= "$mergeBase"; 259 259 } else { 260 $command .= " origin/master";260 $command .= "HEAD"; 261 261 } 262 262 $command .= ":$file"; … … 288 288 } 289 289 my ($after_start, $after_end) = extractLineRangeAfterChange($_); 290 if ($after_start >= 0 && $after_end >= 0 ) {290 if ($after_start >= 0 && $after_end >= 0 && $after_end >= $after_start) { 291 291 push @{$line_ranges_after_changed{$file}}, [ $after_start, $after_end ]; 292 292 } elsif (/DO_NOT_COMMIT/) { … … 2109 2109 } elsif (isGit() && $string =~ /^@@ -\d+(,\d+)? \+(\d+)(,(\d+))? @@/) { 2110 2110 $start = $2; 2111 $end = defined($4) ? $4 + $2 - 1 : $2;2111 $end = defined($4) ? max($start + $4 - 1, $start) : $start; 2112 2112 } 2113 2113 … … 2126 2126 } elsif (isGit() && $string =~ /^@@ -(\d+)(,(\d+))? \+\d+(,\d+)? @@/) { 2127 2127 $start = $1; 2128 $end = defined($3) ? $3 + $1 - 1 : $1;2128 $end = defined($3) ? max($start + $3 - 1, $start) : $start; 2129 2129 } 2130 2130
Note:
See TracChangeset
for help on using the changeset viewer.