|
|
@ -2,27 +2,25 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# mfinfo
|
|
|
|
# mfinfo
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Get the following helpful git info about the working directory:
|
|
|
|
# Provide the following info about the working directory:
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# - 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 or MarlinDev)
|
|
|
|
# - Repo Name (Marlin, MarlinDev, MarlinDocumentation)
|
|
|
|
# - Marlin Target branch (RCBugFix or dev)
|
|
|
|
# - PR Target branch (bugfix-1.1.x, dev, or master)
|
|
|
|
# - Branch Name (the current branch or the one that was passed)
|
|
|
|
# - Branch Arg (the branch argument or current branch)
|
|
|
|
|
|
|
|
# - Current Branch
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
|
|
|
|
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
|
|
|
|
|
|
|
|
[[ -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; }
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -z $REPO ]]; then
|
|
|
|
REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
|
|
|
|
echo "`basename $0`: No 'upstream' remote found." 1>&2 ; exit 1
|
|
|
|
[[ -z $REPO ]] && { echo "`basename $0`: No 'upstream' remote found. (Did you run mfinit?)" 1>&2 ; exit 1; }
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
|
|
|
|
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; }
|
|
|
|
if [[ $ORG != MarlinFirmware ]]; then
|
|
|
|
|
|
|
|
echo "`basename $0`: Not a Marlin repository."
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "$REPO" in
|
|
|
|
case "$REPO" in
|
|
|
|
Marlin ) TARG=bugfix-1.1.x ;;
|
|
|
|
Marlin ) TARG=bugfix-1.1.x ;;
|
|
|
@ -33,13 +31,9 @@ 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/')
|
|
|
|
|
|
|
|
|
|
|
|
case "$#" in
|
|
|
|
case "$#" in
|
|
|
|
0 ) BRANCH=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') ;;
|
|
|
|
0 ) BRANCH=$CURR ;;
|
|
|
|
1 ) BRANCH=$1 ;;
|
|
|
|
1 ) BRANCH=$1 ;;
|
|
|
|
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
|
|
|
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $BRANCH == "(no" ]]; then
|
|
|
|
echo "$ORG $FORK $REPO $TARG $BRANCH $CURR"
|
|
|
|
echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$ORG $FORK $REPO $TARG $BRANCH"
|
|
|
|
|
|
|
|