Github user JonZeolla commented on a diff in the pull request:
https://github.com/apache/metron/pull/1248#discussion_r228614878
--- Diff: dev-utilities/committer-utils/prepare-commit ---
@@ -16,242 +16,31 @@
# limitations under the License.
#
-# not likely to change
-METRON_UPSTREAM="https://git-wip-us.apache.org/repos/asf/metron.git"
-BRO_PLUGIN_UPSTREAM="https://git-wip-us.apache.org/repos/asf/metron-bro-plugin-kafka.git"
-CONFIG_FILE=~/.metron-prepare-commit
-GITHUB_REMOTE="origin"
-BASE_BRANCH=master
+LOCATION_DIR=`dirname $0`
-# does a config file already exist?
-if [ -f $CONFIG_FILE ]; then
- . $CONFIG_FILE
- echo " ...using settings from $CONFIG_FILE"
-fi
+source ${LOCATION_DIR}/metron-committer-common
-# which repo? metron or metron-bro-plugin-kafka
-echo " [1] metron"
-echo " [2] metron-bro-plugin-kafka"
-read -p " which repo? [1]: " INPUT
-case "${INPUT}" in
-
[Bb][Rr][Oo]|[Mm][Ee][Tt][Rr][Oo][Nn]-[Bb][Rr][Oo]-[Pp][Ll][Uu][Gg][Ii][Nn]-[Kk][Aa][Ff][Kk][Aa]|*metron-bro-plugin-kafka\.git|2)
- INPUT="${BRO_PLUGIN_UPSTREAM}" ;;
- [Mm][Ee][Tt][Rr][Oo][Nn]|*metron\.git|1|'')
- INPUT="${METRON_UPSTREAM}" ;;
- *)
- echo "Invalid repo, provided \"${INPUT}\". Please choose between
metron or metron-bro-plugin-kafka"
- exit 1
- ;;
-esac
-[ -n "$INPUT" ] && UPSTREAM=$INPUT
+init_configuration
-CHOSEN_REPO=$(basename ${UPSTREAM%%.git})
+chose_metron_or_bro_repo
-# github account of committer (you)
-if [ -z "$GITHUB_NAME" ]; then
- read -p " your github username [$GITHUB_NAME]: " INPUT
- [ -n "$INPUT" ] && GITHUB_NAME=$INPUT
+init_committer_info
- # write setting to config file
- echo "GITHUB_NAME=$GITHUB_NAME" >> $CONFIG_FILE
-fi
+read_pull_request
-# apache id of committer (you)
-if [ -z "$APACHE_NAME" ]; then
- read -p " your apache userid [$APACHE_NAME]: " INPUT
- [ -n "$INPUT" ] && APACHE_NAME=$INPUT
+setup_working_directory ~/tmp/${CHOSEN_REPO}-pr${PR}
- # write setting to config file
- echo "APACHE_NAME=$APACHE_NAME" >> $CONFIG_FILE
-fi
+setup_code{CHOSEN_REPO}
-# apache email addr of committer (you)
-if [ -z "$APACHE_EMAIL" ]; then
- APACHE_EMAIL=${APACHE_NAME}@apache.org
- read -p " your apache email [$APACHE_EMAIL]: " INPUT
- [ -n "$INPUT" ] && APACHE_EMAIL=$INPUT
+get_contributor_info
- # write setting to config file, so it is not needed next time
- echo "APACHE_EMAIL=$APACHE_EMAIL" >> $CONFIG_FILE
-fi
+get_jira_info
-# retrieve the pull request identifier
-read -p " pull request: " PR
-if [ -z "$PR" ]; then
- echo "Error: missing pr"
- exit 1
-fi
+commit
-# ensure that the pull request exists
-PR_EXISTS=`curl -sI
https://api.github.com/repos/apache/${CHOSEN_REPO}/pulls/$PR | grep Status: |
sed 's/[^0-9]//g'`
-if [ "$PR_EXISTS" != "200" ]; then
- echo "Error: pull request #$PR does not exist"
- exit 1
-fi
+review_commit_info
-# working directory
-WORK=~/tmp/${CHOSEN_REPO}-pr$PR
-read -p " local working directory [$WORK]: " INPUT
-[ -n "$INPUT" ] && WORK=$INPUT
+run_tests
-# handle tilde expansion
-WORK="${WORK/#\~/$HOME}"
+please_review_commit_then
--- End diff --
s/commit_//
---