summaryrefslogtreecommitdiff
path: root/debian/cherry-pick-rev
diff options
context:
space:
mode:
Diffstat (limited to 'debian/cherry-pick-rev')
-rwxr-xr-xdebian/cherry-pick-rev45
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/cherry-pick-rev b/debian/cherry-pick-rev
new file mode 100755
index 00000000..09f60d12
--- /dev/null
+++ b/debian/cherry-pick-rev
@@ -0,0 +1,45 @@
+#!/bin/sh
+Usage() {
+ cat <<EOF
+Usage: ${0##*/} repo revno name
+ cherry pick revno from trunk branch
+
+ This takes care of getting the patch and pulling it into the local
+ directory.
+
+ End result is modified:
+ debian/patches/\${revno}-\${name}
+ debian/patches/series
+EOF
+}
+
+[ $# -eq 3 ] || { Usage 1>&2; exit 1; }
+[ "$1" = "--help" -o "$1" = "-h" ] && { Usage; exit 0; }
+
+repo=${1}
+revno=${2}
+name=${3}
+
+name=${name%.patch}
+name=${name%.diff}
+
+fname="${name}.patch"
+
+( cd "${repo}" && bzr log -r${revno}..${revno} &&
+ bzr diff -p1 -r$((${revno}-1))..${revno} ) |
+ filterdiff --exclude "*/ChangeLog" |
+ quilt import -P "${fname}" /dev/stdin
+
+[ $? -eq 0 ] || { echo "failed"; exit 1; }
+
+cat <<EOF
+now,
+ quilt push
+ quilt refresh
+ rm -f .pc/${fname}/.timestamp
+ files="\$(quilt files ${fname}) debian/patches/series debian/patches/${fname} .pc/${fname} .pc/applied-patches"
+ bzr add \$files
+ dch --append "${name} (cherry pick $revno)"
+ dch --edit # improve the entry
+ debcommit $files
+EOF