Don't rely on upstream/master

This commit is contained in:
su-ex 2021-10-16 23:45:50 +02:00
parent 31c746c5d2
commit 24803095bb
No known key found for this signature in database
GPG Key ID: D743C50C8B61984C
3 changed files with 51 additions and 11 deletions

View File

@ -85,9 +85,10 @@ check_clean_git() {
revert_i18n_changes() {
local i18n_path="$1"
local skip_commit="$2"
local revision="$2"
local skip_commit="$3"
git checkout upstream/master -- "$i18n_path"
git checkout "$revision" -- "$i18n_path"
if [[ "$skip_commit" != [Yy]* ]]; then
git commit -m "Automatic i18n reversion" || true
@ -104,16 +105,23 @@ apply_i18n_changes() {
automatic_i18n_reversion() {
local skip_commit="$1"
local current_upstream_tag
get_current_upstream_tag
local current_mxjssdk_tag
local current_mxreactsdk_tag
get_current_mxsdk_tags
pushd "$SCHILDI_ROOT/matrix-react-sdk" > /dev/null
revert_i18n_changes "$i18n_path" "$skip_commit"
revert_i18n_changes "$i18n_path" "$current_mxreactsdk_tag" "$skip_commit"
popd > /dev/null
pushd "$SCHILDI_ROOT/element-web" > /dev/null
revert_i18n_changes "$i18n_path" "$skip_commit"
revert_i18n_changes "$i18n_path" "$current_upstream_tag" "$skip_commit"
popd > /dev/null
pushd "$SCHILDI_ROOT/element-desktop" > /dev/null
revert_i18n_changes "$i18n_path" "$skip_commit"
revert_i18n_changes "$i18n_path" "$current_upstream_tag" "$skip_commit"
popd > /dev/null
}
@ -196,9 +204,10 @@ bump_release_version() {
revert_packagejson_changes() {
local path="$1"
local skip_commit="$2"
local revision="$2"
local skip_commit="$3"
git checkout upstream/master -- "$path"
git checkout "$revision" -- "$path"
if [[ "$skip_commit" != [Yy]* ]]; then
git commit -m "Automatic package.json reversion" || true
@ -220,7 +229,10 @@ apply_packagejson_overlay() {
automatic_packagejson_reversion() {
local skip_commit="$1"
forelement_repos revert_packagejson_changes "package.json" "$skip_commit"
local current_upstream_tag
get_current_upstream_tag
forelement_repos revert_packagejson_changes "package.json" "$current_upstream_tag" "$skip_commit"
}
automatic_packagejson_adjustment() {
@ -233,3 +245,21 @@ automatic_packagejson_adjustment() {
forelement_repos apply_packagejson_overlay "package.json" "overlay-package.json"
forelement_repos write_version "package.json"
}
get_latest_upstream_tag() {
pushd "$SCHILDI_ROOT/element-web" > /dev/null
git fetch upstream
latest_upstream_tag=`git for-each-ref --sort=creatordate --format '%(refname) %(creatordate)' refs/tags | sed -nr 's|refs/tags/(v[0-9]+(\.[0-9]+(\.[0-9]+)?)?) .*|\1|p' | tail -n 1`
popd > /dev/null
}
get_current_upstream_tag() {
local versions
get_current_versions
current_upstream_tag="v${versions[0]}"
}
get_current_mxsdk_tags() {
current_mxreactsdk_tag="v$(cat "$SCHILDI_ROOT/element-web/package.json" | jq '.dependencies["matrix-react-sdk"]' -r)"
current_mxjssdk_tag="v$(cat "$SCHILDI_ROOT/element-web/package.json" | jq '.dependencies["matrix-js-sdk"]' -r)"
}

View File

@ -23,7 +23,18 @@ automatic_i18n_reversion
automatic_packagejson_reversion
# Merge upstream
forall_repos git merge upstream/master
get_latest_upstream_tag
forelement_repos git merge "$latest_upstream_tag"
get_current_mxsdk_tags
pushd "matrix-js-sdk" > /dev/null
git merge "$current_mxjssdk_tag"
popd > /dev/null
pushd "matrix-react-sdk" > /dev/null
git merge "$current_mxreactsdk_tag"
popd > /dev/null
# Refresh environment
make clean

View File

@ -9,8 +9,7 @@ pushd "$mydir" > /dev/null
source ./merge_helpers.sh
# Fetch to get latest strings for current version
# ToDo: Find out actual versions in case it's not yet merged
# Fetch to get upstream strings for current version
forall_repos git fetch upstream
# Check branch