ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # gg-9869: draft patch-scripts implementation
Date Wed, 04 Mar 2015 09:40:39 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/gg-9869 [created] 2fe52f6ed


# gg-9869: draft patch-scripts implementation


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2fe52f6e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2fe52f6e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2fe52f6e

Branch: refs/heads/gg-9869
Commit: 2fe52f6ed2bf70b37c0d821f9ac1bff89b26e5e4
Parents: be3c24c
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Wed Mar 4 12:41:06 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Wed Mar 4 12:41:06 2015 +0300

----------------------------------------------------------------------
 .gitignore                  |   2 +-
 scripts/git-apply-patch.sh  |  56 ++++++++++++++++
 scripts/git-format-patch.sh | 140 +++++++++++++++++++++++++++++++++++++++
 scripts/git-patch-prop.sh   |  30 +++++++++
 4 files changed, 227 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2fe52f6e/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index cd1e894..296e130 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,6 @@ xcuserdata/
 atlassian-ide-plugin.xml
 *.iml
 target
-target/*
 /libs/
 pom-installed.xml
+git-patch-prop-local.sh
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2fe52f6e/scripts/git-apply-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-apply-patch.sh b/scripts/git-apply-patch.sh
new file mode 100644
index 0000000..a6c0c7c
--- /dev/null
+++ b/scripts/git-apply-patch.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+#
+# Git patch-file applyer.
+#
+
+PATCHED_BRANCH=$1
+
+if [ "${GG_HOME}" = "" ];
+    then GG_HOME=$PWD
+fi
+
+. ${GG_HOME}/scripts/git-patch-prop.sh # Import properties.
+. ${GG_HOME}/scripts/git-patch-prop-local.sh # Import user properties (it will rewrite global
properties).
+
+applyPatch () {
+    GIT_HOME=$1
+    DEFAULT_BRANCH=$2
+    PATCH_FILE=$3
+
+    cd ${GIT_HOME}
+
+    git checkout ${DEFAULT_BRANCH}
+
+#    git apply ${PATCH_FILE}
+    git am ${PATCH_FILE}
+}
+
+IGNITE_PATCH_FILE=${PATCHES_HOME}/${IGNITE_DEFAULT_BRANCH}_${PATCHED_BRANCH}_ignite.patch
+GG_PATCH_FILE=${PATCHES_HOME}/${GG_DEFAULT_BRANCH}_${PATCHED_BRANCH}_gg.patch
+
+if [ -f ${IGNITE_PATCH_FILE} ] # Whether a patch-file exists
+then
+    applyPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${IGNITE_PATCH_FILE}
+fi
+
+if [ -f ${GG_PATCH_FILE} ] # Whether a patch-file exists
+then
+    applyPatch ${GG_HOME} ${GG_DEFAULT_BRANCH} ${GG_PATCH_FILE}
+fi

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2fe52f6e/scripts/git-format-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-format-patch.sh b/scripts/git-format-patch.sh
new file mode 100644
index 0000000..bb84a2b
--- /dev/null
+++ b/scripts/git-format-patch.sh
@@ -0,0 +1,140 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+#
+# Git patch-file maker.
+#
+
+echo 'Usage: git-format-patch.sh <BRANCH_WITH_PATCH>'
+echo 
+
+PATCHED_BRANCH=$1
+MODE=$2
+
+if [ "${GG_HOME}" = "" ];
+    then GG_HOME=$PWD
+fi
+
+. ${GG_HOME}/scripts/git-patch-prop.sh # Import properties.
+. ${GG_HOME}/scripts/git-patch-prop-local.sh # Import user properties (it will rewrite global
properties).
+
+
+# Define functions.
+formatPatch () {
+    GIT_HOME=$1
+    DEFAULT_BRANCH=$2
+    PATCHED_BRANCH=$3
+    PATCH_SUFFIX=$4
+
+    echo
+    echo '>>> FORMAT PATCH FOR BRANCHES '${DEFAULT_BRANCH}' AND '${PATCHED_BRANCH}'
AT '${GIT_HOME}
+    echo
+
+    cd ${GIT_HOME}
+
+#    echo '>>>>>> Checkout '${DEFAULT_BRANCH}
+#    git checkout ${DEFAULT_BRANCH}
+
+#    echo '>>>>>> Create tmpsquash.'
+#    git checkout -b tmpsquash
+#
+#    echo '>>>>>> Merge '${PATCHED_BRANCH}' at tmpsquash'
+#    git merge --squash ${PATCHED_BRANCH}
+#    git commit -a -m "My squashed commits"
+
+    git checkout ${PATCHED_BRANCH}
+
+    echo '>>>>>> Format patch.'
+    git format-patch ${DEFAULT_BRANCH}  --stdout > ${PATCHES_HOME}'/'${DEFAULT_BRANCH}_${PATCHED_BRANCH}${PATCH_SUFFIX}
+
+#    echo '>>>>>> Clean-up.'
+    git checkout ${DEFAULT_BRANCH}
+#    git branch -D tmpsquash # Delete tmp branch.
+}
+
+updateBranches () {
+    GIT_HOME=$1
+    DEFAULT_BRANCH=$2
+    PATCHED_BRANCH=$3
+
+    echo
+    echo '>>> UPDATING BRANCHES '${DEFAULT_BRANCH}' AND '${PATCHED_BRANCH}' AT '${GIT_HOME}
+    echo
+
+    cd ${GIT_HOME}
+
+    git checkout ${DEFAULT_BRANCH}
+    git pull
+
+    git checkout ${PATCHED_BRANCH}
+    echo
+    echo '>>>>>> START MERGING'
+    echo
+    git merge --no-edit ${DEFAULT_BRANCH} # Merge with default message.
+}
+
+# Return value of checkBranchExists function.
+BRANCH_EXISTS=''
+
+checkBranchExists () {
+    GIT_HOME=$1
+    BRANCH=$2
+
+    cd ${GIT_HOME}
+
+    BRANCH_EXISTS=`git show-ref refs/heads/"${BRANCH}"`
+}
+
+
+exitIfBranchDoesNotExist () {
+    checkBranchExists $1 $2
+
+    if [ -z "$BRANCH_EXISTS" ] # If not.
+    then
+        echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+        echo ">>>>>>>>>>>>>>>>>>>>>>>>>>
ERROR >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+        echo ">>> Expected branch ${BRANCH} does not exist at ${GIT_HOME}"
+        echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
+        
+        exit
+    fi
+}
+
+# Main script logic.
+
+# Ignite project.
+checkBranchExists ${IGNITE_HOME} ${PATCHED_BRANCH}
+
+if [ -n "$BRANCH_EXISTS" ]
+then
+    exitIfBranchDoesNotExist ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH}
+
+    updateBranches ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${PATCHED_BRANCH}
+    formatPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${PATCHED_BRANCH} _ignite.patch
+fi
+
+# GridGain project.
+checkBranchExists ${GG_HOME} ${PATCHED_BRANCH}
+
+if [ -n "$BRANCH_EXISTS" ]
+then
+    exitIfBranchDoesNotExist ${GG_HOME} ${GG_DEFAULT_BRANCH}
+
+    updateBranches ${GG_HOME} ${GG_DEFAULT_BRANCH} ${PATCHED_BRANCH}
+    formatPatch ${GG_HOME} ${GG_DEFAULT_BRANCH} ${PATCHED_BRANCH} _gg.patch
+fi

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2fe52f6e/scripts/git-patch-prop.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-prop.sh b/scripts/git-patch-prop.sh
new file mode 100644
index 0000000..03bd534
--- /dev/null
+++ b/scripts/git-patch-prop.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+#
+# Git patch-file maker/applyer properties.
+#
+
+IGNITE_DEFAULT_BRANCH='sprint-2'
+GG_DEFAULT_BRANCH='ignite-sprint-2'
+
+if [ "${IGNITE_HOME}" = "" ];
+    then IGNITE_HOME=${GG_HOME}/../incubator-ignite
+fi
+
+PATCHES_HOME=${GG_HOME}
\ No newline at end of file


Mime
View raw message