Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2016 OmniROM Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 17 | echo -e "Enter the AOSP ref to merge"; |
| 18 | read ref; |
Humberto Borba | 7ea79de | 2016-12-07 20:19:29 -0200 | [diff] [blame] | 19 | |
micky387 | 675aed6 | 2021-05-05 23:42:26 +0200 | [diff] [blame] | 20 | echo -e "Do you want to merge it like squash ? type "yes" or "no" " |
| 21 | read squash |
| 22 | |
| 23 | OPERATION="${squash}" |
| 24 | |
| 25 | branch_name=${ref}"-merge" |
| 26 | |
maxwen | 0b8f56b | 2023-10-07 15:32:48 +0200 | [diff] [blame^] | 27 | branch_current="android-14.0" |
micky387 | 675aed6 | 2021-05-05 23:42:26 +0200 | [diff] [blame] | 28 | |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 29 | cd ../../../ |
| 30 | |
| 31 | while read path; |
| 32 | do |
| 33 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 34 | project=`echo android_${path} | sed -e 's/\//\_/g'`; |
| 35 | aosp_project=${path}; |
| 36 | if [ "${path}" == "build" ] ; then |
| 37 | path="build/make"; |
Humberto Borba | 3429f95 | 2017-09-08 10:49:37 -0300 | [diff] [blame] | 38 | fi |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 39 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 40 | echo ""; |
| 41 | echo "====================================================================="; |
| 42 | echo " PROJECT: ${project} -> [ ${path}/ ]"; |
| 43 | echo ""; |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 44 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 45 | rm -fr $path; |
| 46 | echo " -> repo sync ${path}"; |
| 47 | ret=$(repo sync -d -f --force-sync ${path} 2>&1); |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 48 | cd $path; |
| 49 | |
micky387 | 675aed6 | 2021-05-05 23:42:26 +0200 | [diff] [blame] | 50 | if [[ "${OPERATION}" == "yes" ]]; then |
| 51 | if git branch | grep ${branch_name} > /dev/null; then |
| 52 | git branch -D ${branch_name} > /dev/null |
| 53 | fi |
| 54 | |
| 55 | echo " -> creating branch ${branch_name}"; |
| 56 | ret=$(git checkout -b ${branch_name} 2>&1); |
| 57 | ret=$(repo start ${branch_name}); |
| 58 | fi |
| 59 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 60 | # make sure that environment is clean |
| 61 | ret=$(git merge --abort 2>&1); |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 62 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 63 | echo " -> Merging remote: https://android.googlesource.com/platform/$aosp_project ${ref}"; |
| 64 | ret=$(git pull https://android.googlesource.com/platform/$aosp_project ${ref} 2>&1); |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 65 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 66 | if echo $ret | grep "CONFLICT (content)" > /dev/null ; then |
Marko Man | 3dfc7d3 | 2019-06-03 22:33:47 +0200 | [diff] [blame] | 67 | echo -e " -> \e[33mWARNING!: \e[31mMERGE CONFLICT\e[0m"; |
micky387 | 675aed6 | 2021-05-05 23:42:26 +0200 | [diff] [blame] | 68 | echo -e " -> please fix the merge conflict before push it."; |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 69 | else |
micky387 | 675aed6 | 2021-05-05 23:42:26 +0200 | [diff] [blame] | 70 | if [[ "${OPERATION}" == "yes" ]]; then |
| 71 | echo " -> merging squashed commits into ${branch_current} branch"; |
| 72 | ret=$(git checkout ${branch_current} 2>&1); |
| 73 | ret=$(git merge --squash ${branch_name} 2>&1); |
| 74 | ret=$(git add . 2>&1); |
| 75 | ret=$(git commit --no-edit 2>&1); |
| 76 | fi |
Marko Man | 3dfc7d3 | 2019-06-03 22:33:47 +0200 | [diff] [blame] | 77 | echo -e " -> \e[32mDONE!\e[0m"; |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 78 | fi |
| 79 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 80 | cd - > /dev/null; |
Jake Whatley | 4e1248a | 2016-03-10 21:22:56 -0500 | [diff] [blame] | 81 | |
Humberto Borba | 5dc4c6e | 2018-02-03 00:34:23 -0200 | [diff] [blame] | 82 | done < vendor/omni/utils/aosp-forked-list; |