Skip to content

Instantly share code, notes, and snippets.

@mitchcurtis
Created October 30, 2021 12:08
Show Gist options
  • Save mitchcurtis/042c70f5a9c543476a933dee9eba609b to your computer and use it in GitHub Desktop.
Save mitchcurtis/042c70f5a9c543476a933dee9eba609b to your computer and use it in GitHub Desktop.
Script to sync Qt modules
#!/bin/bash
usageExample="Usage: cd ~/dev/qt-dev/qtdeclarative && git fetch && git reset --hard origin/dev && cd .. && qt-git-sync-to.sh qtdeclarative HEAD"
if [ -z "$1" ]; then
echo "module argument not supplied"
echo $usageExample
exit 1
fi
if [ -z "$2" ]; then
echo "ref argument not supplied"
echo $usageExample
exit 1
fi
foundCmakeFile=false
while [[ "$PWD" != "/" ]]
do
if [ -f cmake/QtSynchronizeRepo.cmake ]
then
echo "found cmake file in $PWD"
foundCmakeFile=true
break
fi
cd ..
done
if [ "$foundCmakeFile" = false ]
then
echo "This script needs to be run within a Qt supermodule clone"
echo $usageExample
exit 1
fi
module="$1"
shift
revision="$1"
shift
if [ ! -d $module ]
then
echo "Can't find module '$module'"
exit 1
fi
git fetch
cmake -DSYNC_TO_MODULE="$module" -DSYNC_TO_BRANCH="$revision" "$@" -P cmake/QtSynchronizeRepo.cmake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment