~ubuntu-branches/ubuntu/saucy/cloud-init/saucy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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="${revno}-${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
  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