summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xformat_patch_dep360
1 files changed, 60 insertions, 0 deletions
diff --git a/format_patch_dep3 b/format_patch_dep3
new file mode 100755
index 0000000..bd3e7ff
--- /dev/null
+++ b/format_patch_dep3
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# patch_debian: generate sensible DEP3 headers from a Asterisk commits
+
+set -e
+
+dir=''
+commit=''
+
+usage() {
+ me=`basename $0`
+ echo "$me: format a DEP3 patch from Asterisk Git-SVN commits"
+ echo ""
+ echo "Usage:"
+ echo " git format-patch --stdout COMMIT(s) | $0 # Recommended"
+ echo " git show COMMIT | $0 # Also works"
+ echo " $0 -c COMMIT [ -d DIRECTORY ] # Shortcut"
+ echo ""
+ echo " COMMIT: git commit to use. Should also work with multiple"
+ echo " patches in a mbox."
+ echo ""
+ echo " DIRECTORY: If set, use git repository from that directory"
+ echo " (change into it first)."
+}
+
+while getopts 'c:d:h' opt; do
+ case "$opt" in
+ c) commit="$OPTARG" ;;
+ d) dir="$OPTARG" ;;
+ h) usage; exit 0;;
+ ?) usage; exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+
+# By default, we just grab what the user provided in the standard input
+get_patch() {
+ cat
+}
+
+if [ "$commit" != '' ]; then
+ #redefine the input function:
+ get_patch() {
+ if [ "$dir" != '' ]; then
+ cd "$dir"
+ fi
+ git format-patch --stdout "$commit"^.."$commit"
+ }
+fi
+
+
+# FIXME: ^' *' makes it work with 'git show', but increases the chance of
+# it changing the actual patch.
+get_patch \
+| sed \
+ -e 's|^ *git-svn-id: http://svn.asterisk.org/[^@]*@\([0-9]\+\) .*|Origin: http://svnview.digium.com/svn/asterisk?view=rev\&rev=\1|' \
+ -e 's|^ *(issue #\([0-9]\+\))$|Bug: https://issues.asterisk.org/view.php?id=\1|i' \
+
+#git-svn-id: git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.4@233609
+#(issue #16299)