blob: ef916cd034b22055ed0d112418952ef8ea20c71c [file] [log] [blame]
Vachounet7ff3bc02021-02-10 14:32:36 +01001#!/bin/bash
2#
3# Copyright (C) 2021 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#
17echo -e "Enter the CAF ref to merge";
18read ref;
19
micky387675aed62021-05-05 23:42:26 +020020echo -e "Do you want to merge it like squash ? type "yes" or "no" "
21read squash
22
23OPERATION="${squash}"
24
25branch_name=${ref}"-merge"
26
micky387ceda3c12025-06-25 13:48:42 -040027branch_current="android-16"
micky387675aed62021-05-05 23:42:26 +020028
Vachounet7ff3bc02021-02-10 14:32:36 +010029cd ../../../
30
31while read path;
32 do
33
34 project=`echo android_${path} | sed -e 's/\//\_/g'`;
35 caf_project=${path};
36 if [ "${path}" == "build" ] ; then
37 path="build/make";
38 fi
39
40 echo "";
41 echo "=====================================================================";
42 echo " PROJECT: ${project} -> [ ${path}/ ]";
43 echo "";
44
45 rm -fr $path;
46 echo " -> repo sync ${path}";
micky38773ea2292024-12-07 21:59:34 -050047 ret=$(repo sync -d --force-sync ${path} 2>&1);
Vachounet7ff3bc02021-02-10 14:32:36 +010048 cd $path;
49
micky387675aed62021-05-05 23:42:26 +020050 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
micky38773ea2292024-12-07 21:59:34 -050060 if [[ -n "$(git status --porcelain)" ]]; then
61 # make sure that environment is clean
62 ret=$(git merge --abort 2>&1);
63 fi
Vachounet7ff3bc02021-02-10 14:32:36 +010064
65 echo " -> Merging remote: https://source.codeaurora.org/quic/la/platform/$caf_project ${ref}";
66 ret=$(git pull https://source.codeaurora.org/quic/la/platform/$caf_project ${ref} 2>&1);
67
micky38773ea2292024-12-07 21:59:34 -050068 if [[ -n "$(git status --porcelain)" ]]; then
Vachounet7ff3bc02021-02-10 14:32:36 +010069 echo -e " -> \e[33mWARNING!: \e[31mMERGE CONFLICT\e[0m";
micky387675aed62021-05-05 23:42:26 +020070 echo -e " -> please fix the merge conflict before push it.";
Vachounet7ff3bc02021-02-10 14:32:36 +010071 else
micky387675aed62021-05-05 23:42:26 +020072 if [[ "${OPERATION}" == "yes" ]]; then
73 echo " -> merging squashed commits into ${branch_current} branch";
74 ret=$(git checkout ${branch_current} 2>&1);
75 ret=$(git merge --squash ${branch_name} 2>&1);
76 ret=$(git add . 2>&1);
77 ret=$(git commit --no-edit 2>&1);
78 fi
Vachounet7ff3bc02021-02-10 14:32:36 +010079 echo -e " -> \e[32mDONE!\e[0m";
80 fi
81
82 cd - > /dev/null;
83
84done < vendor/omni/utils/caf-repos-list;