lorikeet-heimdal: Add a new script to help merging patches from Samba4 to heimdal
authorAndrew Tridgell <tridge@samba.org>
Wed, 1 Dec 2010 02:00:08 +0000 (13:00 +1100)
committerStefan Metzmacher <metze@samba.org>
Wed, 29 Apr 2020 09:07:57 +0000 (11:07 +0200)
apply_heimdal.sh [new file with mode: 0755]

diff --git a/apply_heimdal.sh b/apply_heimdal.sh
new file mode 100755 (executable)
index 0000000..319e4e3
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+[ $# == 1 ] || {
+    echo "Usage: apply_heimdal.sh <lorikeet_path>"
+    exit 1
+}
+
+LORIKEET_PATH="$1"
+
+S4PATH="$PWD"
+
+pushd $LORIKEET_PATH || exit 1
+git reset --hard 
+git am --abort
+popd
+
+try_patch() {
+    commit="$1"
+    git format-patch --stdout $commit -1 > "$commit".patch
+    sed -i 's|/source4/heimdal/|/|g' "$commit".patch
+    pushd $LORIKEET_PATH || exit 1
+    git reset --hard
+    echo
+    if patch -p1 --forward < "$S4PATH/$commit.patch"; then
+       echo
+       echo "Commit $commit can apply - applying"
+       git reset --hard
+       git am "$S4PATH/$commit.patch"
+    else
+       echo
+       echo "Commit $commit does not apply cleanly"
+       echo
+    fi
+    popd || exit 1
+}
+
+commits="$(git log --pretty=oneline --reverse --since='1 months ago' heimdal | cut -d' ' -f1)"
+for c in $commits; do
+    git log $c -1
+    echo -n "Try apply? [Y/n] "
+    read answer
+    case $answer in
+       n*)
+           continue
+           ;;
+        *)
+           try_patch $c
+           ;;
+    esac
+done