Changeset 23748 in webkit
- Timestamp:
- Jun 23, 2007 1:49:16 AM (17 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r23740 r23748 1 2007-06-22 Simon Hausmann <hausmann@kde.org> 2 3 Reviewed by Adam Roben. 4 5 Added support for populating ChangeLog entries from given git commits 6 using --git-commit=<commitish> and --git-reviewer=<name>. 7 8 * Scripts/prepare-ChangeLog: 9 1 10 2007-06-22 Timothy Hatcher <timothy@apple.com> 2 11 -
trunk/WebKitTools/Scripts/prepare-ChangeLog
r21850 r23748 80 80 sub isSVN(); 81 81 82 my $gitCommit = 0; 83 my $gitReviewer = ""; 82 84 my $openChangeLogs = 0; 83 85 my $showHelp = 0; 86 my $spewDiff = $ENV{"PREPARE_CHANGELOG_DIFF"}; 84 87 my $updateChangeLogs = 1; 85 my $spewDiff = $ENV{"PREPARE_CHANGELOG_DIFF"};86 88 my $parseOptionsResult = 87 89 GetOptions("diff|d!" => \$spewDiff, 90 "git-commit:s" => \$gitCommit, 91 "git-reviewer:s" => \$gitReviewer, 88 92 "help|h!" => \$showHelp, 89 93 "open|o!" => \$openChangeLogs, 90 94 "update!" => \$updateChangeLogs); 91 95 if (!$parseOptionsResult || $showHelp) { 92 print STDERR basename($0) . " [-d|--diff] [-h|--help] [-o|--open] [ svndir1 [svndir2 ...]]\n";96 print STDERR basename($0) . " [-d|--diff] [-h|--help] [-o|--open] [--git-commit=<committish>] [--git-reviewer=<name>] [svndir1 [svndir2 ...]]\n"; 93 97 print STDERR " -d|--diff Spew diff to stdout when running\n"; 98 print STDERR " --git-commit Populate the ChangeLogs from the specified git commit\n"; 99 print STDERR " --git-reviewer When populating the ChangeLogs from a git commit claim that the spcified name reviewed the change.\n"; 100 print STDERR " This option is useful when the git commit lacks a Signed-Off-By: line\n"; 94 101 print STDERR " -h|--help Show this help message\n"; 95 102 print STDERR " -o|--open Open ChangeLogs in an editor when done\n"; … … 210 217 || "set EMAIL_ADDRESS environment variable"; 211 218 219 if ($gitCommit) { 220 $name = `$GIT log --max-count=1 --pretty=\"format:%an\" \"$gitCommit\"`; 221 $email_address = `$GIT log --max-count=1 --pretty=\"format:%ae\" \"$gitCommit\"`; 222 } 223 212 224 # Remove trailing parenthesized notes from user name (bit of hack). 213 225 $name =~ s/\(.*?\)\s*$//g; … … 258 270 open CHANGE_LOG, "> ${prefix}ChangeLog" or die "Could not write ${prefix}ChangeLog\n."; 259 271 print CHANGE_LOG "$date $name <$email_address>\n\n"; 260 print CHANGE_LOG " Reviewed by NOBODY (OO" . "PS!).\n\n"; 261 if ($prefix =~ m/WebCore/ || `pwd` =~ m/WebCore/) { 262 print CHANGE_LOG " WARNING: NO TEST CASES ADDED OR CHANGED\n\n" unless $changedLayoutTests; 272 273 if ($gitCommit) { 274 my $gitLog = `$GIT cat-file commit \"$gitCommit\"`; 275 my @lines = split(/\n/, $gitLog); 276 277 my $reviewer = ""; 278 279 $gitLog = ""; 280 my $inHeader = 1; 281 foreach my $line (@lines) { 282 if ($inHeader) { 283 if (!$line) { 284 $inHeader = 0; 285 } 286 next; 287 } 288 if ($line =~ /[Ss]igned-[Oo]ff-[Bb]y: (.+)/) { 289 if (!$reviewer) { 290 $reviewer = $1; 291 } else { 292 $reviewer .= ", " . $1; 293 } 294 } elsif (length $line == 0) { 295 $gitLog = $gitLog . "\n"; 296 } else { 297 $gitLog = $gitLog . " " . $line . "\n"; 298 } 299 } 300 301 if (!$reviewer) { 302 $reviewer = $gitReviewer; 303 } 304 305 if (!$reviewer) { 306 print "WARNING!!! Change was not reviewed!\n"; 307 $reviewer = "NOBODY (OO" . "PS!)"; 308 } 309 310 print CHANGE_LOG " Reviewed by $reviewer.\n\n"; 311 print CHANGE_LOG $gitLog . "\n"; 312 } else { 313 print CHANGE_LOG " Reviewed by NOBODY (OO" . "PS!).\n\n"; 314 if ($prefix =~ m/WebCore/ || `pwd` =~ m/WebCore/) { 315 print CHANGE_LOG " WARNING: NO TEST CASES ADDED OR CHANGED\n\n" unless $changedLayoutTests; 316 } 263 317 } 264 318 … … 872 926 $prefix = "$SVN diff --diff-cmd diff -x -N"; 873 927 } elsif (isGit()) { 874 $prefix = "$GIT diff HEAD --"; 928 if ($gitCommit) { 929 return "$GIT diff \"$gitCommit^\" \"$gitCommit\""; 930 } else { 931 $prefix = "$GIT diff HEAD --"; 932 } 875 933 } 876 934 … … 889 947 # FIXME: This command will give status for the whole repository, not 890 948 # just the files passed in. 891 $command = "$GIT status"; 949 if ($gitCommit) { 950 $command = "$GIT diff -r --name-status -M \"$gitCommit^\" \"$gitCommit\""; 951 } else { 952 $command = "$GIT status"; 953 } 892 954 } 893 955 … … 953 1015 } 954 1016 } elsif (isGit()) { 955 if (/^# Changes to be committed:$/ || /^# Changed but not updated:$/) { 956 $inGitCommitSection = 1; 957 next; 958 } 959 last if $inGitCommitSection && /^# \S/; 960 961 if ($inGitCommitSection && /^#\s+([^:]+):\s+((.+) -> )?(.+)$/) { 962 $status = $1; 963 $original = $3; 964 $file = $4; 1017 if ($gitCommit) { 1018 if (/^([ADM])\t(.+)$/) { 1019 $status = $1; 1020 $file = $2; 1021 } elsif (/^(R)[0-9]{1,3}\t([^\t]+)\t([^\t\n]+)$/) { # for example: R90% newfile oldfile 1022 $status = $1; 1023 $file = $2; 1024 $original = $3; 1025 } else { 1026 print; # error output from git diff 1027 } 1028 } else { 1029 if (/^# Changes to be committed:$/ || /^# Changed but not updated:$/) { 1030 $inGitCommitSection = 1; 1031 next; 1032 } 1033 last if $inGitCommitSection && /^# \S/; 1034 1035 if ($inGitCommitSection && /^#\s+([^:]+):\s+((.+) -> )?(.+)$/) { 1036 $status = $1; 1037 $original = $3; 1038 $file = $4; 1039 } 965 1040 } 966 1041 } … … 1000 1075 ); 1001 1076 1002 return $svn{$status} if isSVN(); 1077 # deliberately share the same description between svn status output and git diff --name-status 1078 return $svn{$status} if (isSVN() || $gitCommit); 1003 1079 return $git{$status} if isGit(); 1004 1080 } … … 1017 1093 1018 1094 return $svn{$status} if isSVN(); 1095 return 0 if $gitCommit; # an existing commit cannot have conflicts 1019 1096 return $git{$status} if isGit(); 1020 1097 } … … 1038 1115 ); 1039 1116 1040 return sprintf($svn{$status}, $original) if isSVN() && exists $svn{$status}; 1117 # deliberately share the same description between svn status output and git diff --name-status 1118 return sprintf($svn{$status}, $original) if (isSVN() || $gitCommit) && exists $svn{$status}; 1041 1119 return sprintf($git{$status}, $original) if isGit() && exists $git{$status}; 1042 1120 return undef;
Note: See TracChangeset
for help on using the changeset viewer.