Update merge helpers
Change-Id: I2da35a52c6f7209acc822c7fd878255df082bc52
This commit is contained in:
parent
bdd71769a0
commit
7d467d622a
|
@ -1,13 +1,41 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
find_last_commit_for_title() {
|
||||||
|
local title="$1"
|
||||||
|
git log --oneline --author=SpiritCroc | grep "$title" | head -n 1 | sed 's| .*||'
|
||||||
|
}
|
||||||
|
|
||||||
|
revert_last() {
|
||||||
|
local title="$1"
|
||||||
|
git revert --no-edit `find_last_commit_for_title "$title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
require_clean_git() {
|
||||||
|
uncommitted=`git status --porcelain`
|
||||||
|
if [ ! -z "$uncommitted" ]; then
|
||||||
|
echo "Uncommitted changes are present, please commit first!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
upstream_latest_tag() {
|
upstream_latest_tag() {
|
||||||
git describe upstream/master --tags
|
git describe upstream/master --tags
|
||||||
}
|
}
|
||||||
upstream_previous_tag() {
|
upstream_previous_tag() {
|
||||||
git describe `upstream_latest_tag`~1 --tags
|
git describe `upstream_latest_tag`~1 --tags
|
||||||
}
|
}
|
||||||
|
downstream_latest_tag() {
|
||||||
|
git describe sc --tags
|
||||||
|
}
|
||||||
|
|
||||||
upstream_diff() {
|
upstream_diff() {
|
||||||
local latest_tag=`upstream_latest_tag`
|
local latest_tag=`upstream_latest_tag`
|
||||||
local previous_tag=`upstream_previous_tag`
|
local previous_tag=`upstream_previous_tag`
|
||||||
git diff "$previous_tag".."$latest_tag" "$@"
|
git diff "$previous_tag".."$latest_tag" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downstream_upstream_diff() {
|
||||||
|
local previous_tag=`upstream_previous_tag`
|
||||||
|
local downstream_tag=`downstream_latest_tag`
|
||||||
|
git diff "$previous_tag".."$downstream_latest_tag" "$@"
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mydir="$(dirname "$(realpath "$0")")"
|
||||||
|
source "$mydir/merge_helpers.sh"
|
||||||
|
|
||||||
|
# Require clean git state
|
||||||
|
require_clean_git
|
||||||
|
|
||||||
|
# Oposite of restore_upstream in post_merge.sh
|
||||||
|
restore_sc() {
|
||||||
|
local f="$(basename "$1")"
|
||||||
|
local path="$(dirname "$1")"
|
||||||
|
local sc_f="tmp_sc_$f"
|
||||||
|
local upstream_f="upstream_$f"
|
||||||
|
if [ -e "$path/$f" ]; then
|
||||||
|
mv "$path/$f" "$path/$upstream_f"
|
||||||
|
fi
|
||||||
|
if [ -e "$path/$sc_f" ]; then
|
||||||
|
mv "$path/$sc_f" "$path/$f"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Keep in sync with pre_merge.sh!
|
||||||
|
restore_sc README.md
|
||||||
|
restore_sc fastlane
|
||||||
|
|
||||||
|
git add -A
|
||||||
|
git commit -m "Automatic upstream merge postprocessing"
|
||||||
|
|
||||||
|
|
||||||
|
"$mydir"/correct_strings.sh
|
||||||
|
|
||||||
|
revert_last 'Revert "Resolve required manual intervention in german strings"'
|
||||||
|
|
||||||
|
while grep -q "wolpertinger\|schlumpfwesen" "$mydir/vector/src/main/res/values-de/strings.xml"; do
|
||||||
|
read -p "Please resolve remaining language, then press enter!"
|
||||||
|
done
|
||||||
|
|
||||||
|
uncommitted=`git status --porcelain`
|
||||||
|
if [ -z "$uncommitted" ]; then
|
||||||
|
echo "Seems like no new language conflicts appeared :)"
|
||||||
|
else
|
||||||
|
git add -A
|
||||||
|
git commit -m 'Resolve required manual intervention in german strings'
|
||||||
|
fi
|
22
pre_merge.sh
22
pre_merge.sh
|
@ -2,23 +2,13 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
mydir="$(dirname "$(realpath "$0")")"
|
||||||
|
source "$mydir/merge_helpers.sh"
|
||||||
|
|
||||||
# Require clean git state
|
# Require clean git state
|
||||||
uncommitted=`git status --porcelain`
|
require_clean_git
|
||||||
if [ ! -z "$uncommitted" ]; then
|
|
||||||
echo "Uncommitted changes are present, please commit first!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
find_last_commit_for_title() {
|
|
||||||
local title="$1"
|
|
||||||
git log --oneline --author=SpiritCroc | grep "$title" | head -n 1 | sed 's| .*||'
|
|
||||||
}
|
|
||||||
|
|
||||||
revert_last() {
|
|
||||||
local title="$1"
|
|
||||||
git revert --no-edit `find_last_commit_for_title "$title"`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# Oposite of restore_sc in post_merge.sh
|
||||||
restore_upstream() {
|
restore_upstream() {
|
||||||
local f="$(basename "$1")"
|
local f="$(basename "$1")"
|
||||||
local path="$(dirname "$1")"
|
local path="$(dirname "$1")"
|
||||||
|
@ -33,7 +23,9 @@ restore_upstream() {
|
||||||
revert_last 'Resolve required manual intervention in german strings'
|
revert_last 'Resolve required manual intervention in german strings'
|
||||||
revert_last 'Automatic SchildiChat string correction'
|
revert_last 'Automatic SchildiChat string correction'
|
||||||
|
|
||||||
|
# Keep in sync with post_merge.sh!
|
||||||
restore_upstream fastlane
|
restore_upstream fastlane
|
||||||
restore_upstream README.md
|
restore_upstream README.md
|
||||||
|
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "[TMP] Automatic upstream merge preparation"
|
git commit -m "[TMP] Automatic upstream merge preparation"
|
||||||
|
|
Loading…
Reference in New Issue