Ray Essick | 1ca2522 | 2020-05-26 14:20:40 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #set -x |
| 3 | |
| 4 | # called for repo projects that are part of the media mainline modules |
| 5 | # this is for projects where the entire project is part of mainline. |
| 6 | # we have a separate script for projects where only part of that project gets |
| 7 | # pulled into mainline. |
| 8 | # |
| 9 | # if the project's PREUPLOAD.cfg points to this script, it is by definition a project |
| 10 | # which is entirely within mainline. |
| 11 | # |
| 12 | # example PREUPLOAD.cfg using this script |
| 13 | # [Hook Scripts] |
| 14 | # mainline_hook = ${REPO_ROOT}/frameworks/av/tools/mainline_hook_project.sh |
| 15 | # |
| 16 | |
| 17 | |
| 18 | # tunables |
| 19 | DEV_BRANCH=rvc-dev |
| 20 | |
| 21 | ### |
| 22 | RED=$(tput setaf 1) |
| 23 | NORMAL=$(tput sgr0) |
| 24 | |
| 25 | ## check the active branch: |
| 26 | ## * b131183694 d198c6a [goog/master] Fix to handle missing checks on error returned |
| 27 | ## |
| 28 | current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/:.*$//'| sed -e 's/^goog\///'` |
| 29 | if [ "${current}" = "" ] ; then |
| 30 | current=unknown |
| 31 | fi |
| 32 | |
| 33 | if [ "${current}" = "${DEV_BRANCH}" ] ; then |
| 34 | # Change appears to be in mainline dev branch |
| 35 | exit 0 |
| 36 | fi |
| 37 | |
| 38 | ## warn the user that about not being on the typical/desired branch. |
| 39 | |
| 40 | cat - <<EOF |
| 41 | |
| 42 | You are uploading repo ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}. |
| 43 | The source of truth for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${DEV_BRANCH}${NORMAL}. |
| 44 | |
| 45 | Please upload this change to branch ${RED}${DEV_BRANCH}${NORMAL} unless one or more of |
| 46 | the following apply: |
| 47 | - this is a security bug prohibited from disclosure before the next dessert release. |
| 48 | (moderate security bugs fall into this category). |
| 49 | - this is new functionality prohibitied from disclosure before the next dessert release. |
| 50 | EOF |
| 51 | |
| 52 | |
| 53 | ## |
| 54 | ## TODO: prompt the user y/n to continue right now instead of re-invoking with no-verify |
| 55 | ## this has to get around how repo buffers stdout from this script such that the output |
| 56 | ## is not flushed before we try to read the input. |
| 57 | ## |
| 58 | |
| 59 | cat - <<EOF |
| 60 | If you are sure you want to proceed uploading to branch ${RED}${current}${NORMAL}, |
| 61 | re-run your repo upload command with the '--no-verify' option |
| 62 | |
| 63 | EOF |
| 64 | exit 1 |
| 65 | |