[merge] Update merge helpers for moved resources

Change-Id: I09de3d8c78e69386fe6020e8d1aa0f4d1b7aa9b6
This commit is contained in:
SpiritCroc 2022-09-10 15:35:39 +02:00
parent bc1f3cb24d
commit 715eefe184
3 changed files with 18 additions and 13 deletions

View File

@ -15,18 +15,19 @@ if [ ! -z "$uncommitted" ]; then
fi fi
mydir="." mydir="."
stringdir="$mydir/library/ui-strings/src/main/res"
# Element -> SchildiChat # Element -> SchildiChat
find "$mydir/vector/src/main/res" -name strings.xml -exec \ find "$stringdir" -name strings.xml -exec \
sed -i 's|Element|SchildiChat|g' '{}' \; sed -i 's|Element|SchildiChat|g' '{}' \;
# Restore Element where it makes sense # Restore Element where it makes sense
find "$mydir/vector/src/main/res" -name strings.xml -exec \ find "$stringdir" -name strings.xml -exec \
sed -i 's/SchildiChat \(Web\|iOS\|Desktop\)/Element \1/g' '{}' \; sed -i 's/SchildiChat \(Web\|iOS\|Desktop\)/Element \1/g' '{}' \;
find "$mydir/vector/src/main/res" -name strings.xml -exec \ find "$stringdir" -name strings.xml -exec \
sed -i 's|SchildiChat Matrix Services|Element Matrix Services|g' '{}' \; sed -i 's|SchildiChat Matrix Services|Element Matrix Services|g' '{}' \;
find "$mydir/vector/src/main/res" -name strings.xml -exec \ find "$stringdir" -name strings.xml -exec \
sed -i 's|\("use_latest_riot">.*\)SchildiChat\(.*</string>\)|\1Element\2|g' '{}' \; sed -i 's|\("use_latest_riot">.*\)SchildiChat\(.*</string>\)|\1Element\2|g' '{}' \;
find "$mydir/vector/src/main/res" -name strings.xml -exec \ find "$stringdir" -name strings.xml -exec \
sed -i 's|\("use_other_session_content_description">.*\)SchildiChat\(.*SchildiChat.*</string>\)|\1SchildiChat/Element\2|' '{}' \; sed -i 's|\("use_other_session_content_description">.*\)SchildiChat\(.*SchildiChat.*</string>\)|\1SchildiChat/Element\2|' '{}' \;
unpatched_strings_file=.tmp_unpatched_strings unpatched_strings_file=.tmp_unpatched_strings
@ -35,8 +36,8 @@ new_patched_strings_file=.tmp_new_patched_strings
patch_file_updated=0 patch_file_updated=0
# Requires manual intervention for correct grammar # Requires manual intervention for correct grammar
#for strings_de in "$mydir/vector/src/main/res/values-de/strings.xml" "$mydir/matrix-sdk-android/src/main/res/values-de/strings.xml"; do #for strings_de in "$stringdir/values-de/strings.xml" "$mydir/matrix-sdk-android/src/main/res/values-de/strings.xml"; do
for strings_de in "$mydir/vector/src/main/res/values-de/strings.xml"; do for strings_de in "$stringdir/values-de/strings.xml"; do
echo "Apply known language fixes to $strings_de..." echo "Apply known language fixes to $strings_de..."
source ./correct_strings_de.sh source ./correct_strings_de.sh
while grep -q "wolpertinger\|schlumpfwesen" "$strings_de"; do while grep -q "wolpertinger\|schlumpfwesen" "$strings_de"; do

View File

@ -3,17 +3,19 @@
set -e set -e
mydir="$(dirname "$(realpath "$0")")" mydir="$(dirname "$(realpath "$0")")"
pushd "$mydir" > /dev/null
mydir=.
source "$mydir/merge_helpers.sh" source "$mydir/merge_helpers.sh"
# Require clean git state # Require clean git state
require_clean_git require_clean_git
# Color corrections | TODO more? # Color corrections | TODO more?
sed -i 's|"@color/riotx_accent"|"?colorAccent"|g' vector/src/*/res/layout/* sed -i 's|"@color/riotx_accent"|"?colorAccent"|g' vector/src/*/res/layout/* library/ui-styles/src/main/res/layout/*
sed -i 's|"@style/VectorButtonStyle"|"?materialButtonStyle"|g' vector/src/*/res/layout/* sed -i 's|"@style/VectorButtonStyle"|"?materialButtonStyle"|g' vector/src/*/res/layout/* library/ui-styles/src/main/res/layout/*
sed -i 's|"@color/element_background_light"|"?backgroundColorLight"|g' vector/src/*/res/layout/* sed -i 's|"@color/element_background_light"|"?backgroundColorLight"|g' vector/src/*/res/layout/* library/ui-styles/src/main/res/layout/*
sed -i 's|#FF4B55|#E53935|g' vector/src/*/res/drawable/* sed -i 's|#FF4B55|#E53935|g' vector/src/*/res/drawable/* vector-app/src/*/res/drawable/*
sed -i 's|#ff4b55|#e53935|g' vector/src/*/res/drawable/* sed -i 's|#ff4b55|#e53935|g' vector/src/*/res/drawable/* vector-app/src/*/res/drawable/*
uncommitted=`git status --porcelain` uncommitted=`git status --porcelain`
if [ -z "$uncommitted" ]; then if [ -z "$uncommitted" ]; then
echo "Seems like colors are still fine :)" echo "Seems like colors are still fine :)"
@ -31,3 +33,5 @@ git add -A
git commit -m "Automatic upstream merge postprocessing" git commit -m "Automatic upstream merge postprocessing"
"$mydir"/correct_strings.sh "$mydir"/correct_strings.sh
popd > /dev/null

View File

@ -9,7 +9,7 @@ source "$mydir/merge_helpers.sh"
require_clean_git require_clean_git
# Revert Schildi's upstream string changes # Revert Schildi's upstream string changes
git checkout `upstream_common_base` -- "$mydir/vector/src/main/res/**/strings.xml" git checkout `upstream_common_base` -- "$mydir/library/ui-strings/src/main/res/**/strings.xml"
git commit -m "Automatic revert to unchanged upstream strings, pt.1" git commit -m "Automatic revert to unchanged upstream strings, pt.1"
# Keep in sync with post_merge.sh! # Keep in sync with post_merge.sh!