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