forked from dhacker29/gitweb_manifest
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathhelper_functions
executable file
·62 lines (53 loc) · 1.24 KB
/
helper_functions
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
# Helper script that can be imported from all scripts
# Yay organization
get_our_head() {
git rev-parse HEAD
}
get_their_head() {
git rev-parse aokp/kitkat
}
verify_clean_pick() {
local our_head=$1
local new_head=$(get_our_head)
if [ "${our_head}" == "${new_head}" ]; then
# Pick failed since HEaD matches
die_dialog
else
echo clean pick
HEAD=${new_head}
fi
}
verify_clean_merge() {
# Opposite logic than picks
local our_head=$1
local new_head=$(get_their_head)
if [ "${our_head}" != "${new_head}" ]; then
# Merge failed since HEAD doesn't match upstream
die_dialog
fi
}
get_latest_ps() {
if [ -z "$1" ] || [ "$1" = '--help' ]
then
echo "error"
else
gerrit=gerrit.aokp.co
project=`git config --get remote.aokp.projectname`
patch="$1"
submission=`echo $patch | cut -f1 -d "/" | tail -c 3`
latest=$( git ls-remote http://$gerrit/$project | grep /changes/$submission/$patch | tail -1 )
latest=${latest#*/*/*/*}
echo "$latest"
fi
}
die() {
echo "$@" 1>&2 ;
exit 0;
}
die_dialog() {
echo "Merge failed. Please fix."
die "resume: $0 --resume | abort: $0 --abort"
exit 0;
}
ROOT=${ANDROID_BUILD_TOP}