My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

mfprep 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env bash
  2. #
  3. # mfprep tag1 [tag2]
  4. #
  5. # Find commits in bugfix-2.1.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.1.x the tag will be prefixed by dev- to distinguish it from the version tag,
  9. # so at every release be sure to create a dev- 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. DEST=2.1.x
  18. # Validate that the required tags exist
  19. MTAG=`git tag | grep -e "^dev-$TAG1\$"`
  20. [[ -n "$MTAG" ]] || { echo "Can't find tag dev-$TAG1" ; exit 1 ; }
  21. MTAG=`git tag | grep -e "^$TAG1\$"`
  22. [[ -n "$MTAG" ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
  23. # Generate log of recent commits for bugfix-2.1.x and DEST
  24. TMPDIR=`mktemp -d`
  25. LOGB="$TMPDIR/log-bf.txt"
  26. LOG2="$TMPDIR/log-2x.txt"
  27. TMPF="$TMPDIR/tmp.txt"
  28. SCRF="$TMPDIR/update-$DEST.sh"
  29. git checkout bugfix-2.1.x
  30. git log --pretty="[%h] %s" dev-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB"
  31. git checkout $DEST
  32. git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag dev-$TAG1" ; exit 1 ; }
  33. # Go through commit text from DEST removing all matches from the bugfix log
  34. cat "$LOG2" | while read line; do
  35. if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[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 ${DEST}\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 +x "$SCRF"
  65. ((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR"