You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/08/07 13:08:40 UTC
[15/17] incubator-ignite git commit: # ignite-1209
# ignite-1209
Signed-off-by: Yakov Zhdanov <yz...@gridgain.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d9acbd1d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d9acbd1d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d9acbd1d
Branch: refs/heads/ignite-843
Commit: d9acbd1da16efac59d3cc44c18c16af2db5f50f2
Parents: ebcdb4b
Author: ashutak <as...@gridgain.com>
Authored: Thu Aug 6 18:21:08 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Aug 6 18:29:44 2015 +0300
----------------------------------------------------------------------
scripts/git-apply-patch.sh | 94 -------------------------------------
scripts/git-patch-functions.sh | 56 ++--------------------
2 files changed, 4 insertions(+), 146 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9acbd1d/scripts/git-apply-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-apply-patch.sh b/scripts/git-apply-patch.sh
deleted file mode 100755
index 757cd26..0000000
--- a/scripts/git-apply-patch.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/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 applier.
-#
-echo 'Usage: scripts/git-apply-patch.sh <ignite-task> [-ih|--ignitehome <path>] [-idb|--ignitedefbranch <branch-name>] [-ph|--patchhome <path>]'
-echo "It should be called from IGNITE_HOME directory."
-echo "Patch will be applied to DEFAULT_BRANCH from PATCHES_HOME."
-echo "Note: you can use ${IGNITE_HOME}/scripts/git-patch-prop-local.sh to set your own local properties (to rewrite settings at git-patch-prop-local.sh). "
-echo
-
-#
-# Init home and import properties and functions.
-#
-if [ -z ${IGNITE_HOME} ] # Script can be called from not IGNITE_HOME if IGNITE_HOME was set.
- then IGNITE_HOME=$PWD
-fi
-
-. ${IGNITE_HOME}/scripts/git-patch-prop.sh # Import properties.
-. ${IGNITE_HOME}/scripts/git-patch-functions.sh # Import patch functions.
-
-if [ -f ${IGNITE_HOME}/scripts/git-patch-prop-local.sh ] # Whether a local user properties file exists.
- then . ${IGNITE_HOME}/scripts/git-patch-prop-local.sh # Import user properties (it will rewrite global properties).
-fi
-
-#
-# Ignite task.
-#
-IGNITE_TASK=$1
-
-#
-# Read command line params.
-#
-while [[ $# > 1 ]]
-do
- key="$1"
-
- case $key in
- -ih|--ignitehome)
- IGNITE_HOME="$2"
- shift
- ;;
-
- -idb|--ignitedefbranch)
- IGNITE_DEFAULT_BRANCH="$2"
- shift
- ;;
-
- -ph|--patchhome)
- PATCHES_HOME="$2"
- shift
- ;;
- *)
-
- echo "Unknown parameter: ${key}"
- ;;
- esac
- shift
-done
-
-echo "IGNITE_HOME : ${IGNITE_HOME}"
-echo "Default branch : ${IGNITE_DEFAULT_BRANCH}"
-echo "Ignite task : ${IGNITE_TASK}"
-echo
-echo "PATCHES_HOME : ${PATCHES_HOME}"
-echo
-
-#
-# Main script logic.
-#
-
-currentAndDefaultBranchesShouldBeEqual ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH}
-
-requireCleanWorkTree ${IGNITE_HOME}
-
-IGNITE_PATCH_FILE=${PATCHES_HOME}/${IGNITE_DEFAULT_BRANCH}_${IGNITE_TASK}.patch
-
-applyPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${IGNITE_PATCH_FILE}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d9acbd1d/scripts/git-patch-functions.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-functions.sh b/scripts/git-patch-functions.sh
index 3cc1bb0..cade691 100644
--- a/scripts/git-patch-functions.sh
+++ b/scripts/git-patch-functions.sh
@@ -50,13 +50,16 @@ formatPatch () {
cd ${GIT_HOME}
git checkout ${DEFAULT_BRANCH}
+
+ DEF_BRANCH_REV="$(git rev-parse --short HEAD)"
+
git checkout -b tmppatch
# Merge to make only one commit.
git merge --squash ${PATCHED_BRANCH}
git commit -a -m "# ${PATCHED_BRANCH}"
- PATCH_FILE=${PATCHES_HOME}'/'${DEFAULT_BRANCH}_${PATCHED_BRANCH}${PATCH_SUFFIX}
+ PATCH_FILE=${PATCHES_HOME}'/'${DEFAULT_BRANCH}_${DEF_BRANCH_REV}_${PATCHED_BRANCH}${PATCH_SUFFIX}
git format-patch ${DEFAULT_BRANCH} --stdout > ${PATCH_FILE}
echo "Patch file created."
@@ -125,55 +128,4 @@ requireCleanWorkTree () {
fi
}
-#
-# Applies patch. Applies patch file created by formatPatch method.
-#
-# Params:
-# - Git home.
-# - Default branch.
-# - File with patch.
-#
-applyPatch () {
- GIT_HOME=$1
- DEFAULT_BRANCH=$2
- PATCH_FILE=$3
-
- cd ${GIT_HOME}
-
- if [ ! -f ${PATCH_FILE} ]
- then
- echo $0", ERROR:"
- echo "Expected patch file not found: $PATCH_FILE."
-
- exit 1
- fi
-
- echo "Patch $PATCH_FILE will be applied to $DEFAULT_BRANCH branch."
-
- git am ${PATCH_FILE}
-}
-
-#
-# Checks that given Default branch and Current branch are equal.
-# Exit with code 1 in error case.
-#
-# Params:
-# - Git home.
-# - Default branch.
-#
-currentAndDefaultBranchesShouldBeEqual () {
- GIT_HOME=$1
- DEFAULT_BRANCH=$2
-
- cd ${GIT_HOME}
-
- CURRENT_BRANCH=$( determineCurrentBranch ${GIT_HOME} )
-
- if [ "$CURRENT_BRANCH" != "$DEFAULT_BRANCH" ]
- then
- echo $0", ERROR:"
- echo "You are not on an expected branch. Your current branch at $GIT_HOME is $CURRENT_BRANCH, should be $DEFAULT_BRANCH."
- exit 1
- fi
-}