My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

mfup 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. if [[ $OLDBRANCH == "(no" ]]; then
  15. echo "Branch is unavailable!"
  16. exit 1
  17. fi
  18. case "$#" in
  19. 0 ) BRANCH=$OLDBRANCH ;;
  20. 1 ) BRANCH=$1 ;;
  21. * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
  22. esac
  23. set -e
  24. echo "Fetching upstream ($ORG/$REPO)..."
  25. git fetch upstream
  26. echo ; echo "Bringing $TARG up to date..."
  27. git checkout -q $TARG || git branch checkout upstream/$TARG -b $TARG && git push --set-upstream origin $TARG
  28. git merge upstream/$TARG
  29. git push origin
  30. if [[ $BRANCH != $TARG ]]; then
  31. echo ; echo "Rebasing $BRANCH on $TARG..."
  32. if git checkout $BRANCH; then
  33. echo
  34. if git rebase $TARG; then
  35. git push -f ; echo
  36. [[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH
  37. else
  38. echo "Looks like merge conflicts. Stopping here."
  39. fi
  40. else
  41. echo "No such branch!" ; echo
  42. git checkout $OLDBRANCH
  43. fi
  44. fi