summaryrefslogtreecommitdiff
path: root/scripts/create-pull-request
blob: 22231519569641b1e8afbc10d02c854e7e2c2bbe (plain)
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
#!/bin/bash
#
# create a pull request for your branch
#

usage() {
    echo "Error: Invalid arguments."
    echo "Usage: "
    echo "$ $0 <commit_id> <contrib_branch>"
    echo "  <commit_id> is a commit identifier, like branch-name, HEAD, hex-commit-id"
    echo "  <contrib_branch> is the branch-name in the git.pokylinux.org/poky-contrib tree"
    exit 1
}

case $# in
    2)
    COMMIT=$1
    CONTRIB_BRANCH=$2
    shift
    ;;
    *)
    usage
    ;;
esac

if [ "$COMMIT" = "" ]; then
    usage
fi

git --no-pager show $COMMIT > /dev/null
if [ "$?" != "0" ]; then
    echo "Invalid Commit."
    usage
fi

git --no-pager diff master..${COMMIT} | diffstat -p1
echo ""
git --no-pager log --no-merges master..${COMMIT} | git --no-pager shortlog


echo "Pull URL: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=${CONTRIB_BRANCH}"