[SM-Commit] GIT changes to master guru-tools by Jaka Kranjc (e386e62443340a0bef861104890b863e23dfe637)

Jaka Kranjc scm at sourcemage.org
Mon Jan 26 08:04:41 EST 2009


GIT changes to master guru-tools by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 dir-cherry-pick  |   32 ++++++++++++++++++++++++++++++++
 smgl-cherry-pick |    6 ++++--
 2 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit e386e62443340a0bef861104890b863e23dfe637
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    dir-cherry-pick: a script for cherry-picking whole paths
    It is smart enough to avoid adding unrelated changes
    
    example: dir-cherry-pick utils/kbd

commit abd241bb9f51b59b92b80fdaf6d1b56f94e19304
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    smgl-cherry-pick: added rough support for -n (no commit)

diff --git a/dir-cherry-pick b/dir-cherry-pick
new file mode 100755
index 0000000..c52f8b9
--- /dev/null
+++ b/dir-cherry-pick
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# a script for cherry-picking whole paths
+# example: dir-cherry-pick utils/kbd
+
+path="$1"
+master=${2:-master} # target branch/commit to check the log against
+
+for i in $path; do
+  [[ -e $i ]] || { echo bad path: $i; exit 1; }
+done
+
+git log --no-merges --pretty=oneline HEAD..$master $path | tac
+echo
+
+echo "Cut and paste desired commits below, then ctrl-D"
+echo "You can paste whole lines from above."
+while read commit junk; do
+  if ! smgl-cherry-pick $commit -n; then
+    echo
+    echo fix the conflict
+    echo and run git commit -F .msg $path; git reset --hard
+    echo then restart me
+    exit 123
+  fi
+  git-show $commit --pretty=format:"%s%n%n%b" | sed '/diff/,$d' > .msg
+  echo "(fake dir cherry-pick from $commit)" >> .msg
+  git commit -F .msg $path
+  git reset --hard
+  echo
+done
+rm -f .msg
diff --git a/smgl-cherry-pick b/smgl-cherry-pick
index e4e26d1..d539401 100755
--- a/smgl-cherry-pick
+++ b/smgl-cherry-pick
@@ -4,8 +4,10 @@
 # good "merging" of HISTORY, ChangeLog and binary files.
 # Conflicts in those files are now rare, but the script has
 # room for improvement.
+# You can pass -n as a second argument to do everything but commit
 rc=0
 commit=$1
+shift
 [[ -z $commit ]] && echo no commit specified && exit 100
 [[ -f ChangeLog ]] || { echo run me from the top dir; exit 99; }
 
@@ -18,7 +20,7 @@ make_exec() {
 # it also must contain diff changes (this enables merging of bins)
 if ! git show $commit | grep -q "^+++.*\(HISTORY\|ChangeLog\)" && git show $commit | grep -q "^+++"; then
   # just do it
-  git cherry-pick $commit
+  git cherry-pick $commit $@
   exit 0
 else
   git reset -q --hard # you need a clean checkout for gcp anyway
@@ -100,7 +102,7 @@ else
 fi
 if [[ $rc == 0 ]]; then
   git show $commit --pretty=format:"%s%n%b%n(cherry-picked from commit %H)" | sed '/^diff --git/,$ d' |
-  git commit -a -F -
+  [[ $@ == ${@//-n/} ]] && git commit -a -F -
 else
 cat << KUKU
 ##########################################################################



More information about the SM-Commit mailing list