2015-04-28 23:45:12 +00:00
|
|
|
#!/bin/bash -eu
|
2014-01-18 00:20:12 +00:00
|
|
|
|
|
|
|
# This script generates a commit that updates the lib/ve submodule
|
|
|
|
# ./bin/updateSubmodule.sh updates to master
|
|
|
|
# ./bin/updateSubmodule.sh hash updates to specified hash
|
|
|
|
|
|
|
|
# cd to the VisualEditor directory
|
|
|
|
cd $(cd $(dirname $0)/..; pwd)
|
|
|
|
|
|
|
|
# Check that both working directories are clean
|
|
|
|
if git status -uno --ignore-submodules | grep -i changes > /dev/null
|
|
|
|
then
|
|
|
|
echo >&2 "Working directory must be clean"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cd lib/ve
|
|
|
|
if git status -uno --ignore-submodules | grep -i changes > /dev/null
|
|
|
|
then
|
|
|
|
echo >&2 "lib/ve working directory must be clean"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
git fetch origin
|
|
|
|
# Create sync-repos branch if needed and reset it to master
|
|
|
|
git checkout -B sync-repos origin/master
|
|
|
|
git submodule update
|
|
|
|
cd lib/ve
|
|
|
|
git fetch origin
|
|
|
|
|
|
|
|
# Figure out what to set the submodule to
|
2015-04-29 00:13:09 +00:00
|
|
|
if [ -n "${1:-}" ]
|
2014-01-18 00:20:12 +00:00
|
|
|
then
|
|
|
|
TARGET="$1"
|
|
|
|
TARGETDESC="$1"
|
|
|
|
else
|
|
|
|
TARGET=origin/master
|
|
|
|
TARGETDESC="master ($(git rev-parse --short origin/master))"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate commit summary
|
|
|
|
# TODO recurse
|
2018-05-10 15:51:37 +00:00
|
|
|
NEWCHANGES=$(git log ..$TARGET --oneline --no-merges --topo-order --reverse --color=never)
|
2017-09-13 16:10:13 +00:00
|
|
|
TASKS=$(git log ..$TARGET --no-merges --format=format:%B | grep "Bug: T" | sort | uniq)
|
2014-01-18 00:20:12 +00:00
|
|
|
NEWCHANGESDISPLAY=$(git log ..$TARGET --oneline --no-merges --reverse --color=always)
|
|
|
|
COMMITMSG=$(cat <<END
|
|
|
|
Update VE core submodule to $TARGETDESC
|
|
|
|
|
|
|
|
New changes:
|
|
|
|
$NEWCHANGES
|
2017-09-13 16:10:13 +00:00
|
|
|
|
|
|
|
$TASKS
|
2014-01-18 00:20:12 +00:00
|
|
|
END
|
|
|
|
)
|
|
|
|
# Check out master of VE core
|
|
|
|
git checkout $TARGET
|
|
|
|
|
|
|
|
# Commit
|
|
|
|
cd ../..
|
|
|
|
git commit lib/ve -m "$COMMITMSG" > /dev/null
|
|
|
|
if [ "$?" == "1" ]
|
|
|
|
then
|
|
|
|
echo >&2 "No changes"
|
|
|
|
else
|
|
|
|
cat >&2 <<END
|
|
|
|
|
|
|
|
|
|
|
|
Created commit with changes:
|
|
|
|
$NEWCHANGESDISPLAY
|
|
|
|
END
|
|
|
|
fi
|