Sync Drupal Distribution Profile With GIT Managed Project
As managing my Drupal distribution - DruStack, with both Drupal.org version and GitHub version, one of the daily duty is to keep their submodules in synchonize. E.g. in case drupal-org.make say we would like to fetch drustack_core as below:
projects[drustack_core][download][branch] = 7.x-23.xprojects[drustack_core][download][type] = gitprojects[drustack_core][download][url] = http://git.drupal.org/project/drustack_core.gitprojects[drustack_core][subdir] = drustack
In GitHub submodule I need to check out the corresponding branch with "7.x-23.x". Moreover, in case drupal-org.make say we would like to fetch multiflex3 as below:
projects[multiflex3][subdir] = contribprojects[multiflex3][version] = 3.2
In GitHub submodule I should check out the corresponding tag with "7.x-3.2", too.
So How to sync it in a handy way?
cat profiles/drustack/drupal-org.make | grep branch | while read LINE; do \ echo $LINE; \ PROJECT=`echo $LINE | sed 's/projects\[\(.*\)\]\[download\].* = \(.*\)/\1/g'`; \ BRANCH=`echo $LINE | sed 's/projects\[\(.*\)\]\[download\].* = \(.*\)/\2/g'`; \ GIT="git --git-dir=`find . -type f -name '.git' | grep "\/$PROJECT\/" | grep -v libraries`"; \ $GIT fetch; \ $GIT checkout $BRANCH; \ $GIT pull; \ $GIT status; \donecat profiles/drustack/drupal-org.make | grep version | while read LINE; do \ echo $LINE; \ PROJECT=`echo $LINE | sed 's/projects\[\(.*\)\]\[version\].* = \(.*\)/\1/g'`; \ TAG="7.x-`echo $LINE | sed 's/projects\[\(.*\)\]\[version\].* = \(.*\)/\2/g'`"; \ GIT="git --git-dir=`find . -type f -name '.git' | grep "\/$PROJECT\/" | grep -v libraries`"; \ $GIT fetch; \ $GIT checkout $TAG; \ $GIT status; \done
Tags: DrupalDevelopment