1#!/bin/bash
2#
3# Create a CL that contains the changes between this branch and a newer branch
4# for a given AIDL interface.
5# Be sure that BRANCH_BASE is the current upstream branch in order to get a CL.
6
7if [[ $# -ne 3 ]]; then
8    echo "Usage: $0 BRANCH_BASE BRANCH_NEW PACKAGE_NAME"
9    echo "- BRANCH_BASE current branch, typically a previous release's dev branch"
10    echo "- BRANCH_NEW end branch, typically goog/master as the latest branch"
11    echo "- PACKAGE_NAME this is the AIDL package name"
12    echo "example of creating the diffs for android.hardware.boot"
13    echo "$ git checkout tm-dev ; repo start review"
14    echo "$ ./anapic_release_diff.sh goog/tm-dev goog/master android.hardware.boot"
15    exit 1
16fi
17
18# for pathmod
19source ${ANDROID_BUILD_TOP}/build/make/envsetup.sh
20
21set -ex
22
23INTERFACE_NAME_NO_VER=${3%@*}
24pushd $(pathmod $INTERFACE_NAME_NO_VER)
25git diff "$1".."$2" android | git apply
26git add -A
27git commit -am "Android $1 to $2: $3" --no-edit
28git diff HEAD~1 --stat
29repo upload . --no-verify --wip --hashtag=anapic_release_review
30popd
31