omni: add scripts to merge pixel specific repos
Change-Id: I01743345ac71b0004e9a065c1e137340160e67a8
diff --git a/utils/pixel-forked-list b/utils/pixel-forked-list
new file mode 100644
index 0000000..4910ebe
--- /dev/null
+++ b/utils/pixel-forked-list
@@ -0,0 +1,5 @@
+device/google/gs101
+device/google/gs101-sepolicy
+device/google/gs-common
+device/google/raviole
+hardware/google/pixel-sepolicy
diff --git a/utils/pixel-merge.sh b/utils/pixel-merge.sh
new file mode 100755
index 0000000..da1fd5e
--- /dev/null
+++ b/utils/pixel-merge.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# Copyright (C) 2016 OmniROM Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+echo -e "Enter the AOSP ref to merge";
+read ref;
+
+echo -e "Do you want to merge it like squash ? type "yes" or "no" "
+read squash
+
+OPERATION="${squash}"
+
+branch_name=${ref}"-merge"
+
+branch_current="android-14.0"
+
+cd ../../../
+
+while read path;
+ do
+
+ project=`echo android_${path} | sed -e 's/\//\_/g'`;
+ aosp_project=${path};
+ if [ "${path}" == "build" ] ; then
+ path="build/make";
+ fi
+
+ echo "";
+ echo "=====================================================================";
+ echo " PROJECT: ${project} -> [ ${path}/ ]";
+ echo "";
+
+ rm -fr $path;
+ echo " -> repo sync ${path}";
+ ret=$(repo sync -d -f --force-sync ${path} 2>&1);
+ cd $path;
+
+ if [[ "${OPERATION}" == "yes" ]]; then
+ if git branch | grep ${branch_name} > /dev/null; then
+ git branch -D ${branch_name} > /dev/null
+ fi
+
+ echo " -> creating branch ${branch_name}";
+ ret=$(git checkout -b ${branch_name} 2>&1);
+ ret=$(repo start ${branch_name});
+ fi
+
+ # make sure that environment is clean
+ ret=$(git merge --abort 2>&1);
+
+ echo " -> Merging remote: https://android.googlesource.com/platform/$aosp_project ${ref}";
+ ret=$(git pull https://android.googlesource.com/platform/$aosp_project ${ref} 2>&1);
+
+ if echo $ret | grep "CONFLICT (content)" > /dev/null ; then
+ echo -e " -> \e[33mWARNING!: \e[31mMERGE CONFLICT\e[0m";
+ echo -e " -> please fix the merge conflict before push it.";
+ else
+ if [[ "${OPERATION}" == "yes" ]]; then
+ echo " -> merging squashed commits into ${branch_current} branch";
+ ret=$(git checkout ${branch_current} 2>&1);
+ ret=$(git merge --squash ${branch_name} 2>&1);
+ ret=$(git add . 2>&1);
+ ret=$(git commit --no-edit 2>&1);
+ fi
+ echo -e " -> \e[32mDONE!\e[0m";
+ fi
+
+ cd - > /dev/null;
+
+done < vendor/omni/utils/pixel-forked-list;
\ No newline at end of file
diff --git a/utils/pixel-push-merge.sh b/utils/pixel-push-merge.sh
new file mode 100755
index 0000000..bcc0f60
--- /dev/null
+++ b/utils/pixel-push-merge.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Copyright (C) 2016 OmniROM Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+echo -e "Enter the username"
+read username
+echo -e "Enter the topic branch name (only needed for gerrit)"
+read topicname
+echo -e "Do you want to push on "github" or "gerrit" ?"
+read admin
+
+OPERATION="${admin}"
+
+url="gerrit.omnirom.org"
+port="29418"
+branch="android-14.0"
+
+cd ../../../
+
+while read path;
+ do
+
+ project=`echo android_${path} | sed -e 's/\//\_/g'`;
+ if [ "${path}" == "build" ] ; then
+ path="build/make";
+ fi
+
+ echo ""
+ echo "====================================================================="
+ echo " PROJECT: ${project} -> [ ${path}/ ]"
+ echo ""
+
+ cd $path;
+
+ echo " Pushing..."
+
+ if [[ "${OPERATION}" == "github" ]]; then
+ echo " git push --no-thin -o skip-validation ssh://${username}@${url}:${port}/${project} HEAD:refs/heads/${branch}"
+ git push --no-thin -o skip-validation ssh://${username}@${url}:${port}/${project} HEAD:refs/heads/${branch}
+ elif [[ "${OPERATION}" == "gerrit" ]]; then
+ echo " git push --no-thin -o skip-validation ssh://${username}@${url}:${port}/${project} HEAD:refs/for/${branch}%topic=${topicname}"
+ git push --no-thin -o skip-validation ssh://${username}@${url}:${port}/${project} HEAD:refs/for/${branch}%topic=${topicname}
+ fi
+ echo ""
+
+ cd - > /dev/null
+
+done < vendor/omni/utils/pixel-forked-list