listRecentCommits.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash -eu
  2. # This script generates a structured git log of commits to the VisualEditor-MediaWiki repository,
  3. # and walks the submodule updates to the lib/ve submodule and the OOjs and OOjs UI pull-through
  4. # build commits to detail all changes since a given branch point.
  5. # Using `git branch -a | grep wmf | sort -V` to automatically pick the latest branch version would
  6. # be nice here, but doesn't work because Mac OS X's version of sort is too old.
  7. # cd to the VisualEditor directory
  8. cd $(cd $(dirname $0)/..; pwd)
  9. # Ensure input is correct
  10. if [ -z "${1:-}" ]
  11. then
  12. echo >&2 "Usage: listRecentCommits.sh <startBranch>"
  13. exit 1
  14. fi
  15. STARTHASH=`git rev-parse $1`
  16. if [ "$?" -ne "0" ]
  17. then
  18. echo >&2 "Parameter is not a valid git branch"
  19. exit 1
  20. fi
  21. echo "Listing changes since '$1' (hash: $STARTHASH)"
  22. echo ""
  23. LOCALCHANGES=`git log $1.. --oneline --no-merges --reverse --color=never |
  24. egrep --color=never -v '(translatewiki|BrowserTest)'`
  25. # Iterate over lines matching "Update VE core submodule"
  26. while read -r CHANGE
  27. do
  28. printf "$CHANGE\n"
  29. if [[ $CHANGE == *"Update VE core submodule"* ]]
  30. then
  31. CHANGEHASH=`cut -f1 -d' ' <<< $CHANGE`
  32. SUBCHANGES=`git log --format=%B -n1 $CHANGEHASH -- |
  33. sed -n -e '/New changes/,/^$/p' |
  34. tail -n +2 |
  35. sed -e '$ d' |
  36. grep --color=never -v 'translatewiki'`
  37. while read -r SUBCHANGE
  38. do
  39. printf "\t$SUBCHANGE\n"
  40. done <<< "$SUBCHANGES"
  41. # Extra new-line between sub-module pulls for clarity
  42. printf "\n"
  43. fi
  44. done <<< "$LOCALCHANGES"
  45. exit