|
||||
0001 #!/usr/bin/env bash 0002 0003 # 0004 # Licensed to the Apache Software Foundation (ASF) under one or more 0005 # contributor license agreements. See the NOTICE file distributed with 0006 # this work for additional information regarding copyright ownership. 0007 # The ASF licenses this file to You under the Apache License, Version 2.0 0008 # (the "License"); you may not use this file except in compliance with 0009 # the License. You may obtain a copy of the License at 0010 # 0011 # http://www.apache.org/licenses/LICENSE-2.0 0012 # 0013 # Unless required by applicable law or agreed to in writing, software 0014 # distributed under the License is distributed on an "AS IS" BASIS, 0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0016 # See the License for the specific language governing permissions and 0017 # limitations under the License. 0018 # 0019 0020 # 0021 # This script follows the base format for testing pull requests against 0022 # another branch and returning results to be published. More details can be 0023 # found at dev/run-tests-jenkins. 0024 # 0025 # Arg1: The Github Pull Request Actual Commit 0026 # known as `ghprbActualCommit` in `run-tests-jenkins` 0027 0028 ghprbActualCommit="$1" 0029 0030 # $ghprbActualCommit is an automatic merge commit generated by GitHub; its parents are some Spark 0031 # master commit and the tip of the pull request branch. 0032 0033 # By diffing$ghprbActualCommit^...$ghprbActualCommit and filtering to examine the diffs of only 0034 # non-test files, we can get changes introduced in the PR and not anything else added to master 0035 # since the PR was branched. 0036 0037 # Handle differences between GNU and BSD sed 0038 if [[ $(uname) == "Darwin" ]]; then 0039 SED='sed -E' 0040 else 0041 SED='sed -r' 0042 fi 0043 0044 source_files=$( 0045 git diff $ghprbActualCommit^...$ghprbActualCommit --name-only `# diff patch against master from branch point` \ 0046 | grep -v -e "\/test" `# ignore files in test directories` \ 0047 | grep -e "\.py$" -e "\.java$" -e "\.scala$" `# include only code files` \ 0048 | tr "\n" " " 0049 ) 0050 0051 new_public_classes=$( 0052 git diff $ghprbActualCommit^...$ghprbActualCommit ${source_files} `# diff patch against master from branch point` \ 0053 | grep "^\+" `# filter in only added lines` \ 0054 | $SED -e "s/^\+//g" `# remove the leading +` \ 0055 | grep -e "trait " -e "class " `# filter in lines with these key words` \ 0056 | grep -e "{" -e "(" `# filter in lines with these key words, too` \ 0057 | grep -v -e "\@\@" -e "private" `# exclude lines with these words` \ 0058 | grep -v -e "^// " -e "^/\*" -e "^ \* " `# exclude comment lines` \ 0059 | $SED -e "s/\{.*//g" `# remove from the { onwards` \ 0060 | $SED -e "s/\}//g" `# just in case, remove }; they mess the JSON` \ 0061 | $SED -e "s/\"/\\\\\"/g" `# escape double quotes; they mess the JSON` \ 0062 | $SED -e "s/^(.*)$/\`\1\`/g" `# surround with backticks for style` \ 0063 | $SED -e "s/^/ \* /g" `# prepend ' *' to start of line` \ 0064 | $SED -e "s/$/\\\n/g" `# append newline to end of line` \ 0065 | tr -d "\n" `# remove actual LF characters` 0066 ) 0067 0068 if [ -z "$new_public_classes" ]; then 0069 echo " * This patch adds no public classes." 0070 else 0071 public_classes_note=" * This patch adds the following public classes _(experimental)_:" 0072 echo -e "${public_classes_note}\n${new_public_classes}" 0073 fi
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |