blob: 8d354707b908a8289afd8a27093a300dfb41f66e [file] [log] [blame]
Ray Essick1ca25222020-05-26 14:20:40 -07001#!/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
19DEV_BRANCH=rvc-dev
20
21###
22RED=$(tput setaf 1)
23NORMAL=$(tput sgr0)
24
25## check the active branch:
26## * b131183694 d198c6a [goog/master] Fix to handle missing checks on error returned
27##
28current=`git branch -vv | grep -P "^\*[^\[]+\[goog/"|sed -e 's/^.*\[//' | sed -e 's/:.*$//'| sed -e 's/^goog\///'`
29if [ "${current}" = "" ] ; then
30 current=unknown
31fi
32
33if [ "${current}" = "${DEV_BRANCH}" ] ; then
34 # Change appears to be in mainline dev branch
35 exit 0
36fi
37
38## warn the user that about not being on the typical/desired branch.
39
40cat - <<EOF
41
42You are uploading repo ${RED}${REPO_PATH}${NORMAL} to branch ${RED}${current}${NORMAL}.
43The source of truth for ${RED}${REPO_PATH}${NORMAL} is branch ${RED}${DEV_BRANCH}${NORMAL}.
44
45Please upload this change to branch ${RED}${DEV_BRANCH}${NORMAL} unless one or more of
46the 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.
50EOF
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
59cat - <<EOF
60If you are sure you want to proceed uploading to branch ${RED}${current}${NORMAL},
61re-run your repo upload command with the '--no-verify' option
62
63EOF
64exit 1
65