Changeset 102559 in webkit
- Timestamp:
- Dec 11, 2011 11:07:56 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r102537 r102559 1 2011-12-11 Kentaro Hara <haraken@chromium.org> 2 3 [Refactoring] Move top-level code to resolve conflicted ChangeLogs into a method 4 https://bugs.webkit.org/show_bug.cgi?id=74257 5 6 Reviewed by Ryosuke Niwa. 7 8 We are planning to write unit-tests for prepare-ChangeLog 9 in a run-leaks_unittest/ manner. This patch is one of the incremental 10 refactorings to remove all top-level code and global variables from 11 prepare-ChangeLog. 12 13 * Scripts/prepare-ChangeLog: Moved top-level code to get the latest ChangeLogs 14 into getLatestChangeLogs(), and moved top-level code to resolve conflicted ChangeLogs 15 into resolveConflictedChangeLogs(). 16 (getLatestChangeLogs): 17 (resolveConflictedChangeLogs): 18 1 19 2011-12-11 Kentaro Hara <haraken@chromium.org> 2 20 -
trunk/Tools/Scripts/prepare-ChangeLog
r102537 r102559 70 70 sub fetchBugDescriptionFromURL($); 71 71 sub findChangeLogs(\%); 72 sub getLatestChangeLogs($); 73 sub resolveConflictedChangeLogs($); 72 74 sub generateNewChangeLogs($$$\%); 73 75 sub firstDirectoryOrCwd(); … … 206 208 207 209 # Get the latest ChangeLog files from svn. 208 my @logs = (); 209 foreach my $prefix (@$prefixes) { 210 push @logs, File::Spec->catfile($prefix || ".", "ChangeLog"); 211 } 212 213 if (@logs && $updateChangeLogs && $isSVN) { 214 print STDERR " Running 'svn update' to update ChangeLog files.\n"; 215 open ERRORS, "-|", $SVN, "update", @logs 216 or die "The svn update of ChangeLog files failed: $!.\n"; 217 my @conflictedChangeLogs; 218 while (my $line = <ERRORS>) { 219 print STDERR " ", $line; 220 push @conflictedChangeLogs, $1 if $line =~ m/^C\s+(.+?)[\r\n]*$/; 221 } 222 close ERRORS; 223 224 if (@conflictedChangeLogs) { 225 print STDERR " Attempting to merge conflicted ChangeLogs.\n"; 226 my $resolveChangeLogsPath = File::Spec->catfile(dirname($0), "resolve-ChangeLogs"); 227 open RESOLVE, "-|", $resolveChangeLogsPath, "--no-warnings", @conflictedChangeLogs 228 or die "Could not open resolve-ChangeLogs script: $!.\n"; 229 print STDERR " $_" while <RESOLVE>; 230 close RESOLVE; 231 } 210 my $changeLogs = getLatestChangeLogs($prefixes); 211 212 if (@$changeLogs && $updateChangeLogs && $isSVN) { 213 resolveConflictedChangeLogs($changeLogs); 232 214 } 233 215 … … 248 230 249 231 # Open ChangeLogs. 250 if ($openChangeLogs && @ logs) {232 if ($openChangeLogs && @$changeLogs) { 251 233 print STDERR " Opening the edited ChangeLog files.\n"; 252 234 my $editor = $ENV{CHANGE_LOG_EDITOR}; 253 235 if ($editor) { 254 system ((split ' ', $editor), @ logs);236 system ((split ' ', $editor), @$changeLogs); 255 237 } else { 256 238 $editor = $ENV{CHANGE_LOG_EDIT_APPLICATION}; 257 239 if ($editor) { 258 system "open", "-a", $editor, @ logs;240 system "open", "-a", $editor, @$changeLogs; 259 241 } else { 260 system "open", "-e", @ logs;242 system "open", "-e", @$changeLogs; 261 243 } 262 244 } … … 447 429 } 448 430 return (\%filesInChangeLog, \@prefixes); 431 } 432 433 sub getLatestChangeLogs($) 434 { 435 my ($prefixes) = @_; 436 437 my @changeLogs = (); 438 foreach my $prefix (@$prefixes) { 439 push @changeLogs, File::Spec->catfile($prefix || ".", "ChangeLog"); 440 } 441 return \@changeLogs; 442 } 443 444 sub resolveConflictedChangeLogs($) 445 { 446 my ($changeLogs) = @_; 447 448 print STDERR " Running 'svn update' to update ChangeLog files.\n"; 449 open ERRORS, "-|", $SVN, "update", @$changeLogs 450 or die "The svn update of ChangeLog files failed: $!.\n"; 451 my @conflictedChangeLogs; 452 while (my $line = <ERRORS>) { 453 print STDERR " ", $line; 454 push @conflictedChangeLogs, $1 if $line =~ m/^C\s+(.+?)[\r\n]*$/; 455 } 456 close ERRORS; 457 458 return if !@conflictedChangeLogs; 459 460 print STDERR " Attempting to merge conflicted ChangeLogs.\n"; 461 my $resolveChangeLogsPath = File::Spec->catfile(dirname($0), "resolve-ChangeLogs"); 462 open RESOLVE, "-|", $resolveChangeLogsPath, "--no-warnings", @conflictedChangeLogs 463 or die "Could not open resolve-ChangeLogs script: $!.\n"; 464 print STDERR " $_" while <RESOLVE>; 465 close RESOLVE; 449 466 } 450 467
Note: See TracChangeset
for help on using the changeset viewer.