| 1 | #!/bin/sh |
| 2 | # Copyright 2018 Jonas Smedegaard <[email protected]> |
| 3 | # Description: helper script to cherry-pick upstream patches |
| 4 | # |
| 5 | # This program is free software; |
| 6 | # you can redistribute it and/or modify it |
| 7 | # under the terms of the GNU General Public License |
| 8 | # as published by the Free Software Foundation; |
| 9 | # either version 3, or (at your option) any later version. |
| 10 | |
| 11 | set -eu |
| 12 | |
| 13 | TREEISH=$1 |
| 14 | FORK=${2:-} |
| 15 | |
| 16 | #DATEFORMAT='format:%Y%m%d' |
| 17 | DATEFORMAT='iso-strict' |
| 18 | |
| 19 | if [ -n "$FORK" ]; then |
| 20 | PREFIX="debian/patches/$FORK/" |
| 21 | mkdir -p "debian/patches/$FORK" |
| 22 | else |
| 23 | PREFIX="debian/patches/0" |
| 24 | fi |
| 25 | |
| 26 | export PREFIX |
| 27 | |
| 28 | git log --right-only --no-merges \ |
| 29 | --pretty='%h %ad' --date="$DATEFORMAT" \ |
| 30 | "$TREEISH" \ |
| 31 | | perl -ane '`git log -p $F[0]^..$F[0] > $ENV{PREFIX}$F[1]~$F[0].patch`' |