forked from groeck/chromeos-rebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find-topic.sh
executable file
·93 lines (81 loc) · 1.65 KB
/
find-topic.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
sha=$1
if [ "${sha}" = "" ]
then
echo "Need SHA to search topic"
exit 1
fi
rebasedb=$(python -c "from config import rebasedb; print rebasedb;")
sql="select sha,topic,description from commits where sha is \"${sha}\""
sqlite3 ${rebasedb} "${sql}" | sed -e 's/|/ /g'
exit 0
tlist=${t1}
while [ "$2" != "" ]
do
sql="${sql} or topic=$2"
tlist= "${tlist}, $2"
shift
done
echo "# ${tlist}"
sql="${sql};"
sqlite3 ${rebasedb} "${sql}" | while read line
do
dotag=0
fromupstream=0
conflicts=0
f1=$(echo ${line} | awk -F '|' '{print $1}') # disposition
f2=$(echo ${line} | awk -F '|' '{print $2}') # sha
f3=$(echo ${line} | awk -F '|' '{print $3}') # replacement sha
f4=$(echo ${line} | awk -F '|' '{print $4}') # description
case "${f1}" in
"replace")
f2_old=${f2}
f2=${f3}
f1="pick"
fromupstream=1
;;
"pick" | "drop")
;;
"tag")
# maybe later
dotag=1
# f1="pick"
;;
"squash")
# maybe later
# f1="pick"
;;
"conflicts")
# maybe later
# f1="pick"
;;
*)
echo "Oops"
exit 1
;;
esac
if [ "${f1}" = "squash" ]
then
# special processing.
echo "exec dosquash49.sh ${f2} ${f4}"
continue
fi
if [ "${f1}" != "pick" -a "${f1}" != "edit" -a "${f1}" != "reword" ]
then
continue
fi
# echo "cherry-picking ${f2}"
if [ ${fromupstream} -ne 0 ]
then
echo "pick ${f2_old} ${f4}"
echo "exec fromupstream.py --replace ${f2}"
elif [ ${dotag} -ne 0 ]
then
echo "pick ${f2} ${f4}"
echo "exec dotag.sh"
elif [ ${conflicts} -ne 0 ]
then
echo "exec doconflicts49.sh ${f2} ${f4}"
else
echo "${f1} ${f2} ${f4}"
fi
done