|
|
|
@ -2,15 +2,19 @@
|
|
|
|
|
#
|
|
|
|
|
# mfinfo
|
|
|
|
|
#
|
|
|
|
|
# Provide the following info about the working directory:
|
|
|
|
|
# Print the following info about the working copy:
|
|
|
|
|
#
|
|
|
|
|
# - Remote (upstream) Org name (MarlinFirmware)
|
|
|
|
|
# - Remote (origin) Org name (your Github username)
|
|
|
|
|
# - Repo Name (Marlin, MarlinDocumentation)
|
|
|
|
|
# - PR Target branch (bugfix-1.1.x, bugfix-2.0.x, dev-2.1.x, etc.)
|
|
|
|
|
# - PR Target branch (e.g., bugfix-2.0.x)
|
|
|
|
|
# - Branch Arg (the branch argument or current branch)
|
|
|
|
|
# - Current Branch
|
|
|
|
|
#
|
|
|
|
|
# Example output
|
|
|
|
|
# > mfinfo -q ongoing
|
|
|
|
|
# MarlinFirmware john.doe Marlin bugfix-2.0.x ongoing bugfix-2.0.x -q
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
|
|
|
|
|
[[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; }
|
|
|
|
@ -26,37 +30,37 @@ FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
|
|
|
|
|
|
|
|
|
|
# Defaults if no arguments given
|
|
|
|
|
BRANCH=$CURR
|
|
|
|
|
INDEX=1
|
|
|
|
|
MORE=""
|
|
|
|
|
INDEX=2
|
|
|
|
|
|
|
|
|
|
# Loop through arguments
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
|
# Get an arg and maybe a val to go with it
|
|
|
|
|
opt="$1" ; shift ; val="$1"
|
|
|
|
|
|
|
|
|
|
# Split up an arg containing =
|
|
|
|
|
IFS='=' read -a PARTS <<<"$opt"
|
|
|
|
|
[[ "${PARTS[1]}" != "" ]] && { EQUALS=1 ; opt="${PARTS[0]}" ; val="${PARTS[1]}" ; }
|
|
|
|
|
|
|
|
|
|
GOODVAL=1
|
|
|
|
|
if [[ "$val" =~ ^-{1,2}.* || ! "$opt" =~ ^-{1,2}.* ]]; then
|
|
|
|
|
GOODVAL=0
|
|
|
|
|
val=""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
case "$opt" in
|
|
|
|
|
-*|--*) MORE="$MORE$opt " ; [[ $EQUALS == 1 ]] && MORE="$MORE=$val" ;;
|
|
|
|
|
1|2|3) INDEX=$opt ;;
|
|
|
|
|
-*|--*) MORE=" $MORE$opt" ; ((EQUALS)) && MORE="$MORE=$val" ;;
|
|
|
|
|
1|2) INDEX=$opt ;;
|
|
|
|
|
*) BRANCH="$opt" ;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
case "$REPO" in
|
|
|
|
|
Marlin ) TARG=bugfix-2.0.x ; [[ $INDEX == 1 ]] && TARG=bugfix-1.1.x ; [[ $INDEX == 3 ]] && TARG=dev-2.1.x ;;
|
|
|
|
|
Marlin ) TARG=bugfix-2.0.x ; ((INDEX == 1)) && TARG=bugfix-1.1.x ; [[ $BRANCH =~ ^[12]$ ]] && USAGE=1 ;;
|
|
|
|
|
Configurations ) TARG=import-2.0.x ;;
|
|
|
|
|
MarlinDocumentation ) TARG=master ;;
|
|
|
|
|
AutoBuildMarlin ) TARG=master ;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
[[ $BRANCH =~ ^[123]$ ]] && USAGE=1
|
|
|
|
|
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1 ; }
|
|
|
|
|
|
|
|
|
|
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3] [branch]" 1>&2 ; exit 1 ; }
|
|
|
|
|
|
|
|
|
|
echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE"
|
|
|
|
|
echo "$ORG $FORK $REPO $TARG $BRANCH $CURR$MORE"
|
|
|
|
|