ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [2/9] incubator-ignite git commit: # patch-scripts: review
Date Mon, 06 Apr 2015 03:20:57 GMT
# patch-scripts: review


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

Branch: refs/heads/ignite-639
Commit: a95e8de4377eeb6a840031d0254096f063590d36
Parents: 015420f
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Fri Apr 3 18:55:48 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Fri Apr 3 18:55:48 2015 +0300

----------------------------------------------------------------------
 scripts/git-apply-patch.sh     | 32 +++++++++++++----------
 scripts/git-format-patch.sh    | 35 +++++++++++++------------
 scripts/git-patch-functions.sh | 51 ++++++++++++++++++++++++++++++++-----
 scripts/git-patch-prop.sh      | 10 +++-----
 4 files changed, 86 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a95e8de4/scripts/git-apply-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-apply-patch.sh b/scripts/git-apply-patch.sh
old mode 100644
new mode 100755
index 448421b..500b0a5
--- a/scripts/git-apply-patch.sh
+++ b/scripts/git-apply-patch.sh
@@ -17,7 +17,7 @@
 #
 
 #
-# Git patch-file applyer.
+# 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."
@@ -26,6 +26,20 @@ echo "Note: you can use ${IGNITE_HOME}/scripts/git-patch-prop-local.sh
to set yo
 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
@@ -42,32 +56,24 @@ do
         IGNITE_HOME="$2"
         shift
         ;;
+        
         -idb|--ignitedefbranch)
         IGNITE_DEFAULT_BRANCH="$2"
         shift
         ;;
+        
         -ph|--patchhome)
         PATCHES_HOME="$2"
         shift
         ;;
         *)
-                # unknown option
+        
+        echo "Unknown parameter: ${key}"
         ;;
     esac
     shift
 done
 
-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
-
 echo "IGNITE_HOME    : ${IGNITE_HOME}"
 echo "Master branch  : ${IGNITE_DEFAULT_BRANCH}"
 echo "Ignite task    : ${IGNITE_TASK}"

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a95e8de4/scripts/git-format-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-format-patch.sh b/scripts/git-format-patch.sh
old mode 100644
new mode 100755
index 575a7bb..970347f
--- a/scripts/git-format-patch.sh
+++ b/scripts/git-format-patch.sh
@@ -26,6 +26,20 @@ echo "Note: you can use ${IGNITE_HOME}/scripts/git-patch-prop-local.sh
to set yo
 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
+
+#
 # Read command line params.
 #
 while [[ $# > 1 ]]
@@ -37,35 +51,24 @@ do
         IGNITE_HOME="$2"
         shift
         ;;
+        
         -idb|--ignitedefbranch)
         IGNITE_DEFAULT_BRANCH="$2"
         shift
         ;;
+        
         -ph|--patchhome)
         PATCHES_HOME="$2"
         shift
         ;;
+        
         *)
-                # unknown option
+        echo "Unknown parameter: ${key}"
         ;;
     esac
     shift
 done
 
-#
-# 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_CURRENT_BRANCH=$( determineCurrentBranch ${IGNITE_HOME} )
 
 echo "IGNITE_HOME    : ${IGNITE_HOME}"
@@ -81,4 +84,4 @@ echo
 
 requireCleanWorkTree ${IGNITE_HOME}
 
-formatPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${IGNITE_CURRENT_BRANCH} _ignite.patch
\ No newline at end of file
+formatPatch ${IGNITE_HOME} ${IGNITE_DEFAULT_BRANCH} ${IGNITE_CURRENT_BRANCH} .patch
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a95e8de4/scripts/git-patch-functions.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-functions.sh b/scripts/git-patch-functions.sh
index ab9bec3..796bccd 100644
--- a/scripts/git-patch-functions.sh
+++ b/scripts/git-patch-functions.sh
@@ -23,6 +23,16 @@
 #
 # Define functions.
 #
+
+#
+# Formats patch. Create patch in one commit from user who run script and with default comment.
+#
+# Params:
+# - Git home.
+# - Default branch.
+# - Patch with patch.
+# - Suffix for created patch-file.
+#
 formatPatch () {
     GIT_HOME=$1
     DEFAULT_BRANCH=$2
@@ -33,11 +43,10 @@ formatPatch () {
 
     git checkout ${DEFAULT_BRANCH}
     git checkout -b tmppatch
-    
-    git merge --no-edit ${PATCHED_BRANCH}
-#    Or we can 'squashe' merge to make only one commit.
-#    git merge --squash ${PATCHED_BRANCH}
-#    git commit -a -m "# PATCHED_BRANCH"
+
+    # 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}
 
@@ -52,6 +61,13 @@ formatPatch () {
     echo "Patch created: ${PATCH_FILE}"
 }
 
+#
+# Determines current branch.
+#
+# Params:
+# - Git home.
+# Return - Current branch.
+#
 determineCurrentBranch () {
     GIT_HOME=$1
     
@@ -62,6 +78,13 @@ determineCurrentBranch () {
     echo "$CURRENT_BRANCH"
 }
 
+#
+# Checks that given git repository has clean work tree (there is no uncommited changes).
+# Exit with code 1 in error case.
+#
+# Params:
+# - Git home.
+#
 requireCleanWorkTree () {
     cd $1 # At git home.
 
@@ -94,6 +117,14 @@ 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
@@ -110,10 +141,18 @@ applyPatch () {
     fi
 
     echo "Patch $PATCH_FILE will be applied to $DEFAULT_BRANCH branch."
-#    git apply ${PATCH_FILE}
+    
     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

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a95e8de4/scripts/git-patch-prop.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-prop.sh b/scripts/git-patch-prop.sh
index 7eb3639..9c52583 100644
--- a/scripts/git-patch-prop.sh
+++ b/scripts/git-patch-prop.sh
@@ -17,12 +17,8 @@
 #
 
 #
-# Git patch-file maker/applyer properties.
+# Git patch-file maker/applier properties.
 #
-if [ "${IGNITE_DEFAULT_BRANCH}" = "" ]
-    then IGNITE_DEFAULT_BRANCH='sprint-2'
-fi
+IGNITE_DEFAULT_BRANCH='ignite-sprint-3'
 
-if [ "${PATCHES_HOME}" = "" ]
-    then PATCHES_HOME=${GG_HOME}
-fi
\ No newline at end of file
+PATCHES_HOME=${IGNITE_HOME}


Mime
View raw message