Skip to content

Commit 99e030c

Browse files
committed
Add script for auto-propagating changes to modern branches where possible [skip ci]
1 parent 02a68f7 commit 99e030c

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

scripts/propagate.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -e
3+
4+
WORK_DIR=`mktemp -d`
5+
6+
# deletes the temp directory
7+
function cleanup {
8+
cd $HOME
9+
rm -rf "$WORK_DIR"
10+
}
11+
12+
trap cleanup EXIT
13+
14+
# clone ModernFix repo
15+
16+
echo "downloading temporary modernfix..."
17+
cd $WORK_DIR
18+
git clone https://github.com/embeddedt/ModernFix mfix &>/dev/null
19+
cd mfix
20+
21+
# gather version list
22+
readarray -t all_versions < <(git ls-remote --heads origin | awk '{print $2}' | sed 's:.*/::' | sort -V)
23+
echo "found versions: ${all_versions[@]}"
24+
25+
# checkout base version
26+
git checkout -b propagations/${all_versions[0]} origin/${all_versions[0]} &>/dev/null
27+
28+
our_version=${all_versions[0]}
29+
restore_version=$our_version
30+
31+
for version in "${all_versions[@]}"; do
32+
if ! { echo "$version"; echo "$our_version"; } | sort --version-sort --check &>/dev/null; then
33+
echo -n "merging $our_version into ${version}... "
34+
git checkout -b propagations/$version origin/$version &>/dev/null
35+
if git merge -m "Merge $our_version into $version" propagations/$our_version >/dev/null; then
36+
echo "done"
37+
git push -u origin propagations/$version:$version &>/dev/null
38+
else
39+
echo "failed, this merge must be done manually"
40+
exit 1
41+
fi
42+
our_version=$version
43+
fi
44+
done
File renamed without changes.

0 commit comments

Comments
 (0)