|
@ -7,11 +7,15 @@ |
|
|
# - Remote (upstream) Org name (MarlinFirmware) |
|
|
# - Remote (upstream) Org name (MarlinFirmware) |
|
|
# - Remote (origin) Org name (your Github username) |
|
|
# - Remote (origin) Org name (your Github username) |
|
|
# - Repo Name (Marlin, MarlinDev, MarlinDocumentation) |
|
|
# - Repo Name (Marlin, MarlinDev, MarlinDocumentation) |
|
|
# - PR Target branch (bugfix-2.0.x, dev, or master) |
|
|
# - PR Target branch (bugfix-1.1.x, bugfix-2.0.x, or master) |
|
|
# - Branch Arg (the branch argument or current branch) |
|
|
# - Branch Arg (the branch argument or current branch) |
|
|
# - Current Branch |
|
|
# - Current Branch |
|
|
# |
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
usage() { |
|
|
|
|
|
echo "Usage: `basename $0` [1|2] [branch]" 1>&2 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') |
|
|
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') |
|
|
[[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; } |
|
|
[[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; } |
|
|
[[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; } |
|
|
[[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; } |
|
@ -23,17 +27,29 @@ ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') |
|
|
[[ $ORG == MarlinFirmware ]] || { echo "`basename $0`: Not a Marlin repository." 1>&2 ; exit 1; } |
|
|
[[ $ORG == MarlinFirmware ]] || { echo "`basename $0`: Not a Marlin repository." 1>&2 ; exit 1; } |
|
|
|
|
|
|
|
|
case "$REPO" in |
|
|
case "$REPO" in |
|
|
Marlin ) TARG=bugfix-2.0.x ;; |
|
|
Marlin ) TARG=bugfix-1.1.x ; |
|
|
MarlinDev ) TARG=dev ;; |
|
|
[[ $# > 0 ]] && [[ $1 == 2 ]] && TARG=bugfix-2.0.x |
|
|
|
|
|
;; |
|
|
MarlinDocumentation ) TARG=master ;; |
|
|
MarlinDocumentation ) TARG=master ;; |
|
|
esac |
|
|
esac |
|
|
|
|
|
|
|
|
FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') |
|
|
FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') |
|
|
|
|
|
|
|
|
|
|
|
# BRANCH can be given as the last argument |
|
|
case "$#" in |
|
|
case "$#" in |
|
|
0 ) BRANCH=$CURR ;; |
|
|
0 ) BRANCH=$CURR ;; |
|
|
1 ) BRANCH=$1 ;; |
|
|
1 ) |
|
|
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;; |
|
|
case "$1" in |
|
|
|
|
|
1|2) BRANCH=$CURR ;; |
|
|
|
|
|
*) BRANCH=$1 ;; |
|
|
|
|
|
esac |
|
|
|
|
|
;; |
|
|
|
|
|
2 ) |
|
|
|
|
|
case "$1" in |
|
|
|
|
|
1|2) BRANCH=$2 ;; |
|
|
|
|
|
*) usage ; exit 1 ;; |
|
|
|
|
|
esac |
|
|
|
|
|
;; |
|
|
esac |
|
|
esac |
|
|
|
|
|
|
|
|
echo "$ORG $FORK $REPO $TARG $BRANCH $CURR" |
|
|
echo "$ORG $FORK $REPO $TARG $BRANCH $CURR" |
|
|