mirror of
https://github.com/SchildiChat/schildichat-desktop.git
synced 2025-03-31 21:24:27 +02:00
Automate rebase with patches
This commit is contained in:
parent
eb706739a9
commit
8f70dea230
39
generate_patches.sh
Executable file
39
generate_patches.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mydir="$(dirname "$(realpath "$0")")"
|
||||||
|
pushd "$mydir" > /dev/null
|
||||||
|
|
||||||
|
source ./merge_helpers.sh
|
||||||
|
|
||||||
|
persist_patches() {
|
||||||
|
local repo="$(realpath "$1")"
|
||||||
|
local patch_dir="$SCHILDI_ROOT/patches/$(basename "$1")"
|
||||||
|
if [ ! -d "$repo" ]; then
|
||||||
|
echo "Unknown repo: $repo"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd "$repo"
|
||||||
|
|
||||||
|
if [ -d "$patch_dir" ]; then
|
||||||
|
echo "Clearing old patches..."
|
||||||
|
rm "$patch_dir"/*
|
||||||
|
else
|
||||||
|
echo "Creating new patch dir $patch_dir..."
|
||||||
|
mkdir "$patch_dir"
|
||||||
|
fi
|
||||||
|
echo "Creating new patches"
|
||||||
|
git format-patch -k upstream/master.. -o "$patch_dir"
|
||||||
|
echo "Clearing automated commits from patches"
|
||||||
|
find "$patch_dir" -name "*-Automatic-package.json-adjustment.patch" -exec rm {} \;
|
||||||
|
find "$patch_dir" -name "*-Update-version-to-*.patch" -exec rm {} \;
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
|
persist_patches element-desktop
|
||||||
|
#persist_patches element-web
|
||||||
|
persist_patches matrix-react-sdk
|
||||||
|
|
||||||
|
popd > /dev/null
|
@ -4,57 +4,36 @@ set -e
|
|||||||
|
|
||||||
mydir="$(dirname "$(realpath "$0")")"
|
mydir="$(dirname "$(realpath "$0")")"
|
||||||
|
|
||||||
if [ "$1" = "--checkout" ]; then
|
|
||||||
git_action=checkout
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
git_action=merge
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd "$mydir" > /dev/null
|
pushd "$mydir" > /dev/null
|
||||||
|
|
||||||
source ./merge_helpers.sh
|
source ./merge_helpers.sh
|
||||||
|
|
||||||
if [ "$git_action" = "checkout" ]; then
|
# Persist current state
|
||||||
# Abandon all local submodule state
|
./generate_patches.sh
|
||||||
forall_repos git reset --hard
|
|
||||||
git submodule update -f --recursive
|
|
||||||
else
|
|
||||||
# Check branch
|
|
||||||
check_branch $branch
|
|
||||||
forall_repos check_branch $branch
|
|
||||||
|
|
||||||
# Ensure clean git state
|
# Abandon all local submodule state
|
||||||
forall_repos check_clean_git
|
forall_repos git reset --hard
|
||||||
fi
|
git submodule update -f --recursive
|
||||||
|
|
||||||
# Fetch upstream
|
# Fetch upstream
|
||||||
forall_repos git fetch upstream
|
forall_repos git fetch upstream
|
||||||
|
|
||||||
# Automatic reversions
|
|
||||||
if [ "$git_action" != "checkout" ]; then
|
|
||||||
automatic_i18n_reversion
|
|
||||||
automatic_packagejson_reversion
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Merge upstream
|
|
||||||
|
|
||||||
# Check if specific version to merge passed
|
# Check if specific version to merge passed
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
get_latest_upstream_tag
|
get_latest_upstream_tag
|
||||||
else
|
else
|
||||||
latest_upstream_tag="$1"
|
latest_upstream_tag="$1"
|
||||||
fi
|
fi
|
||||||
forelement_repos git "$git_action" "$latest_upstream_tag"
|
forelement_repos git checkout "$latest_upstream_tag"
|
||||||
|
|
||||||
get_current_mxsdk_tags
|
get_current_mxsdk_tags
|
||||||
|
|
||||||
pushd "matrix-js-sdk" > /dev/null
|
pushd "matrix-js-sdk" > /dev/null
|
||||||
git "$git_action" "$current_mxjssdk_tag"
|
git checkout "$current_mxjssdk_tag"
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
pushd "matrix-react-sdk" > /dev/null
|
pushd "matrix-react-sdk" > /dev/null
|
||||||
git "$git_action" "$current_mxreactsdk_tag"
|
git checkout "$current_mxreactsdk_tag"
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
||||||
# Refresh environment
|
# Refresh environment
|
||||||
@ -62,11 +41,9 @@ make clean
|
|||||||
make setup
|
make setup
|
||||||
|
|
||||||
# Apply our patches
|
# Apply our patches
|
||||||
if [ "$git_action" = "checkout" ]; then
|
apply_patches matrix-react-sdk
|
||||||
#apply_patches matrix-react-sdk
|
#apply_patches element-web
|
||||||
#apply_patches element-web
|
apply_patches element-desktop
|
||||||
apply_patches element-desktop
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Automatic adjustments
|
# Automatic adjustments
|
||||||
#automatic_i18n_adjustment
|
#automatic_i18n_adjustment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user