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 2.3KB

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