My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mfinfo 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. #
  3. # mfinfo
  4. #
  5. # Get the following helpful git info about the working directory:
  6. #
  7. # - Remote (upstream) Org name (MarlinFirmware)
  8. # - Remote (origin) Org name (your Github username)
  9. # - Repo Name (Marlin or MarlinDev)
  10. # - Marlin Target branch (RCBugFix or dev)
  11. # - Branch Name (the current branch or the one that was passed)
  12. #
  13. REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
  14. if [[ -z $REPO ]]; then
  15. echo "`basename $0`: No 'upstream' remote found." 1>&2 ; exit 1
  16. fi
  17. ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
  18. if [[ $ORG != MarlinFirmware ]]; then
  19. echo "`basename $0`: Not a Marlin repository."
  20. exit 1
  21. fi
  22. case "$REPO" in
  23. Marlin ) TARG=RCBugFix ;;
  24. MarlinDev ) TARG=dev ;;
  25. MarlinDocumentation ) TARG=master ;;
  26. esac
  27. FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/')
  28. case "$#" in
  29. 0 ) BRANCH=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') ;;
  30. 1 ) BRANCH=$1 ;;
  31. * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
  32. esac
  33. if [[ $BRANCH == "(no" ]]; then
  34. echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1
  35. fi
  36. echo "$ORG $FORK $REPO $TARG $BRANCH"