File: backport.sh

package info (click to toggle)
libgit2 1.9.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 60,764 kB
  • sloc: ansic: 203,205; javascript: 2,458; sh: 1,763; python: 384; perl: 99; php: 65; makefile: 33
file content (23 lines) | stat: -rwxr-xr-x 462 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

if test $# -eq 0
then
    echo "USAGE: $0 <#PR> [<#PR>...]"
    exit
fi

commits=

for pr in $*
do
    mergecommit=$(git rev-parse ":/Merge pull request #$pr" || exit 1)
    mergebase=$(git merge-base "$mergecommit"^1 "$mergecommit"^2 || exit 1)

    commits="$commits $(git rev-list --reverse "$mergecommit"^2 ^"$mergebase")"
done

echo "Cherry-picking the following commits:"
git rev-list --no-walk --oneline $commits
echo

git cherry-pick $commits