|
Lines 44-50
sub canonicalRelativePath($);
a/WebKitTools/Scripts/resolve-ChangeLogs_sec1
|
| 44 |
sub conflictFiles($); |
44 |
sub conflictFiles($); |
| 45 |
sub findChangeLog($); |
45 |
sub findChangeLog($); |
| 46 |
sub findUnmergedChangeLogs(); |
46 |
sub findUnmergedChangeLogs(); |
| 47 |
sub fixChangeLogPatch($); |
|
|
| 48 |
sub fixMergedChangeLogs($;@); |
47 |
sub fixMergedChangeLogs($;@); |
| 49 |
sub fixOneMergedChangeLog($); |
48 |
sub fixOneMergedChangeLog($); |
| 50 |
sub hasGitUnmergedFiles(); |
49 |
sub hasGitUnmergedFiles(); |
|
Lines 281-337
sub findUnmergedChangeLogs()
a/WebKitTools/Scripts/resolve-ChangeLogs_sec2
|
| 281 |
return @results; |
280 |
return @results; |
| 282 |
} |
281 |
} |
| 283 |
|
282 |
|
| 284 |
sub fixChangeLogPatch($) |
|
|
| 285 |
{ |
| 286 |
my $patch = shift; |
| 287 |
my $contextLineCount = 3; |
| 288 |
|
| 289 |
return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\n( .*\n)+(\+.*\n)+( .*\n){$contextLineCount}$/m; |
| 290 |
my ($oldLineCount, $newLineCount) = ($1, $2); |
| 291 |
return $patch if $oldLineCount <= $contextLineCount; |
| 292 |
|
| 293 |
# The diff(1) command is greedy when matching lines, so a new ChangeLog entry will |
| 294 |
# have lines of context at the top of a patch when the existing entry has the same |
| 295 |
# date and author as the new entry. This nifty loop alters a ChangeLog patch so |
| 296 |
# that the added lines ("+") in the patch always start at the beginning of the |
| 297 |
# patch and there are no initial lines of context. |
| 298 |
my $newPatch; |
| 299 |
my $lineCountInState = 0; |
| 300 |
my $oldContentLineCountReduction = $oldLineCount - $contextLineCount; |
| 301 |
my $newContentLineCountWithoutContext = $newLineCount - $oldLineCount - $oldContentLineCountReduction; |
| 302 |
my ($stateHeader, $statePreContext, $stateNewChanges, $statePostContext) = (1..4); |
| 303 |
my $state = $stateHeader; |
| 304 |
foreach my $line (split(/\n/, $patch)) { |
| 305 |
$lineCountInState++; |
| 306 |
if ($state == $stateHeader && $line =~ /^@@ -1,$oldLineCount \+1,$newLineCount @\@$/) { |
| 307 |
$line = "@@ -1,$contextLineCount +1," . ($newLineCount - $oldContentLineCountReduction) . " @@"; |
| 308 |
$lineCountInState = 0; |
| 309 |
$state = $statePreContext; |
| 310 |
} elsif ($state == $statePreContext && substr($line, 0, 1) eq " ") { |
| 311 |
$line = "+" . substr($line, 1); |
| 312 |
if ($lineCountInState == $oldContentLineCountReduction) { |
| 313 |
$lineCountInState = 0; |
| 314 |
$state = $stateNewChanges; |
| 315 |
} |
| 316 |
} elsif ($state == $stateNewChanges && substr($line, 0, 1) eq "+") { |
| 317 |
# No changes to these lines |
| 318 |
if ($lineCountInState == $newContentLineCountWithoutContext) { |
| 319 |
$lineCountInState = 0; |
| 320 |
$state = $statePostContext; |
| 321 |
} |
| 322 |
} elsif ($state == $statePostContext) { |
| 323 |
if (substr($line, 0, 1) eq "+" && $lineCountInState <= $oldContentLineCountReduction) { |
| 324 |
$line = " " . substr($line, 1); |
| 325 |
} elsif ($lineCountInState > $contextLineCount && substr($line, 0, 1) eq " ") { |
| 326 |
next; # Discard |
| 327 |
} |
| 328 |
} |
| 329 |
$newPatch .= $line . "\n"; |
| 330 |
} |
| 331 |
|
| 332 |
return $newPatch; |
| 333 |
} |
| 334 |
|
| 335 |
sub fixMergedChangeLogs($;@) |
283 |
sub fixMergedChangeLogs($;@) |
| 336 |
{ |
284 |
{ |
| 337 |
my $revisionRange = shift; |
285 |
my $revisionRange = shift; |