You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
9 years ago
|
#!/usr/bin/env bash
|
||
|
#
|
||
5 years ago
|
# mfpr [1|2|3]
|
||
9 years ago
|
#
|
||
6 years ago
|
# Make a PR against bugfix-1.1.x or bugfix-2.0.x
|
||
9 years ago
|
#
|
||
|
|
||
5 years ago
|
[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2|3] [branch]" 1>&2 ; exit 1; }
|
||
9 years ago
|
|
||
8 years ago
|
MFINFO=$(mfinfo "$@") || exit 1
|
||
9 years ago
|
IFS=' ' read -a INFO <<< "$MFINFO"
|
||
|
ORG=${INFO[0]}
|
||
|
FORK=${INFO[1]}
|
||
|
REPO=${INFO[2]}
|
||
|
TARG=${INFO[3]}
|
||
|
BRANCH=${INFO[4]}
|
||
8 years ago
|
OLDBRANCH=${INFO[5]}
|
||
9 years ago
|
|
||
8 years ago
|
[[ $BRANCH == $TARG ]] && { echo "Can't create a PR from the PR Target ($BRANCH). Make a copy first." 1>&2 ; exit 1; }
|
||
9 years ago
|
|
||
8 years ago
|
[[ $BRANCH != $OLDBRANCH ]] && { git checkout $BRANCH || exit 1; }
|
||
9 years ago
|
|
||
8 years ago
|
# See if it's been pushed yet
|
||
9 years ago
|
if [ -z "$(git branch -vv | grep ^\* | grep \\[origin)" ]; then firstpush; fi
|
||
|
|
||
5 years ago
|
which xdg-open >/dev/null && TOOL=xdg-open
|
||
|
which gnome-open >/dev/null && TOOL=gnome-open
|
||
|
which open >/dev/null && TOOL=open
|
||
9 years ago
|
URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
|
||
|
|
||
5 years ago
|
if [ -z "$OPEN" ]; then
|
||
9 years ago
|
echo "Can't find a tool to open the URL:"
|
||
|
echo $URL
|
||
|
else
|
||
|
echo "Opening a New PR Form..."
|
||
5 years ago
|
"$OPEN" "$URL"
|
||
9 years ago
|
fi
|
||
8 years ago
|
|
||
|
[[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH
|