1#!/bin/bash 2 3if [[ $# -lt 2 ]] 4then 5 echo "applies the current git diff in source version in each target version" 6 echo "can be used to, for example, make changes in "'unversioned'" then" 7 echo "duplicate those changes in previous versions" 8 echo 9 echo "usage: from docs directory," 10 echo " ./scripts/versionpatch.sh <src> <target1> <target2> ..." 11 echo 12 echo "example:" 13 echo " ./scripts/versionpatch.sh unversioned v8.0.0 v7.0.0" 14 exit 15fi 16 17src_version=$1 18 19shift 20for version in $*; do 21 echo Patching in `pwd` 22 23 # copy new files 24 pushd versions/$src_version > /dev/null 25 for f in $(git ls-files -o --exclude-standard); do 26 mkdir -p ../$version/$(dirname $f) 27 cp $f ../$version/$(dirname $f)/ 28 done 29 popd > /dev/null 30 31 # patch changes in existing files 32 pushd versions/$version > /dev/null 33 git diff -- ../$src_version | patch -p4 34 popd > /dev/null 35done 36