Skip to content

Instantly share code, notes, and snippets.

@danybony
Last active August 29, 2015 14:07
Show Gist options
  • Save danybony/225f7b255612cafaa89e to your computer and use it in GitHub Desktop.
Save danybony/225f7b255612cafaa89e to your computer and use it in GitHub Desktop.
Multi-project Gource
#!/bin/bash
# Every repository is contained in a subdirectory of the current one
repos=$(ls -d */)
FINAL_LOG_FILE=result_log.txt
rm $FINAL_LOG_FILE
touch $FINAL_LOG_FILE
for repo in ${repos[*]}
do
echo "Processing $repo"
# Pull the last repo version
cd $repo
git pull
cd ..
# Create gource log
repo_log="$repo"_gource.txt
gource --output-custom-log $repo_log $repo
# Add project-specific root directory
repo_log_different_tree="$repo"_gource_2.txt
sedRegex="s#(.+)\|#\1|/$repo#"
sed -E $sedRegex $repo_log > $repo_log_different_tree
# Merge this repo log with the other repos ones
temp_log=temp.txt
cp $FINAL_LOG_FILE $temp_log
cat $repo_log_different_tree $temp_log | sort -n > $FINAL_LOG_FILE
# Clean temp files
rm $repo_log
rm $repo_log_different_tree
rm $temp_log
done
echo "Final gource log saved to $FINAL_LOG_FILE. To show it use"
echo " gource $FINAL_LOG_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment