summaryrefslogtreecommitdiff
path: root/lkft-merge-from-mirror.sh
blob: 467530bd9c64240545a49b944090fcc6e7946632 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash -e

. $(dirname $0)/functions

PATCHES=0
if [ -n "$1" ]; then
        AOSP="$1"
else
        AOSP="`pwd`"
fi

if ! [ -d "$AOSP" ] && [ -d "$AOSP"/build ]; then
        echo "This script must be run from the AOSP source directory"
        echo "or with the AOSP source directory as its first parameter."
        exit 1
fi

function create_local_branch(){
    local branch_name=$1 && shift

    res=$(git branch --list ${branch_name})
    if [ -n "${res}" ]; then
        git branch -m ${branch_name} ${branch_name}-old
    fi
    git checkout -b ${branch_name} remotes/aosp/${branch_name}
    if [ -n "${res}" ]; then
        git branch -D ${branch_name}-old
    fi
}

#KERNEL_BRANCH=android-hikey-linaro-4.19
#BUILD_KERNEL_SRC_DIR=kernel/linaro/hisilicon-4.19
#KERNEL_BRANCH_MERGE_FROM=mirror-android-4.19

if [ -z "${KERNEL_BRANCH}" ]; then
    echo "KERNEL_BRANCH is not specified"
    echo "Please check and try again"
    exit 1
fi

if [ ! -d "${BUILD_KERNEL_SRC_DIR}" ]; then
    echo "BUILD_KERNEL_SRC_DIR is not specified"
    echo "Please check and try again"
    exit 1
fi

if [ -z "${KERNEL_BRANCH_MERGE_FROM}" ]; then
    echo "Please specify KERNEL_BRANCH_MERGE_FROM in the configs"
    exit 1
fi

cd ${BUILD_KERNEL_SRC_DIR}
create_local_branch "${KERNEL_BRANCH_MERGE_FROM}"
create_local_branch "${KERNEL_BRANCH}"
git merge --log --no-edit ${KERNEL_BRANCH_MERGE_FROM}
cd -

# next need to run following command to submit the change to gerrit
# git push https://android.googlesource.com/kernel/hikey-linaro HEAD:refs/for/android-hikey-linaro-4.19
# adb root && adb shell cat /proc/version && adb remount && \
#    adb shell screencap -p /data/local/tmp/bbb.png && adb pull /data/local/tmp/bbb.png /tmp/bbb.png  && gnome-open /tmp/bbb.png