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

mfup 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env bash
  2. #
  3. # mfup
  4. #
  5. # - Fetch latest upstream and replace the PR Target branch with
  6. # - Rebase the (current or specified) branch on the PR Target
  7. # - Force-push the branch to 'origin'
  8. # -
  9. #
  10. [[ $# < 2 ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; }
  11. MFINFO=$(mfinfo "$@") || exit 1
  12. IFS=' ' read -a INFO <<< "$MFINFO"
  13. ORG=${INFO[0]}
  14. FORK=${INFO[1]}
  15. REPO=${INFO[2]}
  16. TARG=${INFO[3]}
  17. BRANCH=${INFO[4]}
  18. OLDBRANCH=${INFO[5]}
  19. set -e
  20. # Prevent accidental loss of current changes
  21. [[ $(git stash) != "No local "* ]] && HAS_STASH=1
  22. echo "Fetching upstream ($ORG/$REPO)..."
  23. git fetch upstream
  24. echo ; echo "Bringing $TARG up to date..."
  25. if [[ ! $(git checkout -q $TARG) ]]; then
  26. git reset --hard upstream/$TARG
  27. git push -f origin
  28. else
  29. git checkout upstream/$TARG -b $TARG
  30. git push --set-upstream origin $TARG
  31. fi
  32. if [[ $BRANCH != $TARG ]]; then
  33. echo ; echo "Rebasing $BRANCH on $TARG..."
  34. if git checkout $BRANCH; then
  35. echo
  36. if git rebase $TARG; then
  37. git push -f
  38. else
  39. echo "Looks like merge conflicts. Stopping here." ; exit
  40. fi
  41. else
  42. echo "No such branch!"
  43. fi
  44. fi
  45. echo
  46. [[ $BRANCH != $OLDBRANCH ]] && git checkout $OLDBRANCH
  47. [[ $HAS_STASH == 1 ]] && git stash pop