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.

mfup 1013B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/env bash
  2. #
  3. # mfup
  4. #
  5. # Fetch and merge upstream changes, optionally with a branch
  6. #
  7. MFINFO=$(mfinfo) || exit
  8. IFS=' ' read -a INFO <<< "$MFINFO"
  9. ORG=${INFO[0]}
  10. FORK=${INFO[1]}
  11. REPO=${INFO[2]}
  12. TARG=${INFO[3]}
  13. OLDBRANCH=${INFO[4]}
  14. case "$#" in
  15. 0 ) BRANCH=$OLDBRANCH ;;
  16. 1 ) BRANCH=$1 ;;
  17. * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
  18. esac
  19. set -e
  20. echo "Fetching upstream ($ORG/$REPO)..."
  21. git fetch upstream
  22. echo ; echo "Bringing $TARG up to date..."
  23. git checkout -q $TARG || git branch checkout upstream/$TARG -b $TARG && git push --set-upstream origin $TARG
  24. git merge upstream/$TARG
  25. git push origin
  26. if [[ $BRANCH != $TARG ]]; then
  27. echo ; echo "Rebasing $BRANCH on $TARG..."
  28. if git checkout $BRANCH; then
  29. echo
  30. if git rebase $TARG; then
  31. git push -f ; echo
  32. [[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH
  33. else
  34. echo "Looks like merge conflicts. Stopping here."
  35. fi
  36. else
  37. echo "No such branch!" ; echo
  38. git checkout $OLDBRANCH
  39. fi
  40. fi