My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

mfprep 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. #
  3. # mfprep tag1 [tag2]
  4. #
  5. # Find commits in bugfix-2.0.x not yet in 2.0.x
  6. #
  7. SED=$(which gsed sed | head -n1)
  8. SELF=`basename "$0"`
  9. [[ $# < 1 || $# > 2 ]] && { echo "Usage $SELF tag1 [tag2]" ; exit 1 ; }
  10. TAG1=$1
  11. TAG2=${2:-"HEAD"}
  12. # Validate that the required tags exist
  13. MTAG=`git tag | grep -e "^bf-$TAG1\$"`
  14. [[ -n $MTAG ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
  15. MTAG=`git tag | grep -e "^$TAG1\$"`
  16. [[ -n $MTAG ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
  17. # Generate log of recent commits for bugfix-2.0.x and 2.0.x
  18. TMPDIR=`mktemp -d`
  19. LOGB="$TMPDIR/log-bf.txt"
  20. LOG2="$TMPDIR/log-20x.txt"
  21. TMPF="$TMPDIR/tmp.txt"
  22. SCRF="$TMPDIR/update-20x.sh"
  23. git checkout bugfix-2.0.x
  24. git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB"
  25. git checkout 2.0.x
  26. git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
  27. # Go through commit text from 2.0.x removing all matches from the bugfix log
  28. cat "$LOG2" | while read line; do
  29. #echo "... $line"
  30. if [[ $line =~ (\(#[0-9]{5}\))$ ]]; then
  31. PATT=${BASH_REMATCH[1]}
  32. #echo "... $PATT"
  33. else
  34. PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" )
  35. fi
  36. [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
  37. done
  38. # Convert remaining commits into git commands
  39. echo -e "#!/usr/bin/env bash\nset -e\ngit checkout 2.0.x\n" >"$TMPF"
  40. cat "$LOGB" | while read line; do
  41. if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then
  42. CID=${BASH_REMATCH[1]}
  43. REST=${BASH_REMATCH[2]}
  44. echo "git cherry-pick $CID ;# $REST" >>"$TMPF"
  45. else
  46. echo ";# $line" >>"$TMPF"
  47. fi
  48. done
  49. mv "$TMPF" "$SCRF"
  50. chmod ug+x "$SCRF"
  51. open "$TMPDIR"