Skip to content

Commit

Permalink
Add script for auto-propagating changes to modern branches where poss…
Browse files Browse the repository at this point in the history
…ible [skip ci]
  • Loading branch information
embeddedt committed Jun 12, 2023
1 parent 02a68f7 commit 99e030c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions scripts/propagate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -e

WORK_DIR=`mktemp -d`

# deletes the temp directory
function cleanup {
cd $HOME
rm -rf "$WORK_DIR"
}

trap cleanup EXIT

# clone ModernFix repo

echo "downloading temporary modernfix..."
cd $WORK_DIR
git clone https://github.com/embeddedt/ModernFix mfix &>/dev/null
cd mfix

# gather version list
readarray -t all_versions < <(git ls-remote --heads origin | awk '{print $2}' | sed 's:.*/::' | sort -V)
echo "found versions: ${all_versions[@]}"

# checkout base version
git checkout -b propagations/${all_versions[0]} origin/${all_versions[0]} &>/dev/null

our_version=${all_versions[0]}
restore_version=$our_version

for version in "${all_versions[@]}"; do
if ! { echo "$version"; echo "$our_version"; } | sort --version-sort --check &>/dev/null; then
echo -n "merging $our_version into ${version}... "
git checkout -b propagations/$version origin/$version &>/dev/null
if git merge -m "Merge $our_version into $version" propagations/$our_version >/dev/null; then
echo "done"
git push -u origin propagations/$version:$version &>/dev/null
else
echo "failed, this merge must be done manually"
exit 1
fi
our_version=$version
fi
done
File renamed without changes.

0 comments on commit 99e030c

Please sign in to comment.