Skip to content

Instantly share code, notes, and snippets.

@qqii
Forked from Sotilrac/gource-multi-repo.sh
Last active November 5, 2022 00:51
Show Gist options
  • Save qqii/964c41c0c858a9b2514a83321a750a0b to your computer and use it in GitHub Desktop.
Save qqii/964c41c0c858a9b2514a83321a750a0b to your computer and use it in GitHub Desktop.
Generates gource video out of multiple repositories. Uses avconv to export the video file.
# Automatically run gource on multiple repositories
# https://github.com/acaudwell/Gource/wiki/Visualizing-Multiple-Repositories
$Resolution = "1920x1080"
$Title = "Software Development"
$Output = "output.mp4"
$BackgroundColour = "38383D"
$FPS = "30"
$Repositories = @('artcam-express-store', 'bin2c', 'blackbox', 'carveco', 'carveco-icons', 'carveco-po', 'carveco-release-sandbox', 'ccuser', 'ddx', 'ddxman', 'delcam-cmake', 'derek-the-goat', 'dgkman', 'diagnostics', 'dongle-emulator-service', 'genman', 'grafman', 'guiman', 'hallmark', 'health-check', 'herbert-walker', 'legacy-decryption-service', 'legacy-decryption-table-generator', 'licence-api', 'license-server', 'mcuser', 'mswman', 'package-recipies', 'partner-portal', 'pdftron', 'pmpost', 'psteam-slack-bot', 'shopify-auth0', 'toolbox-addins', 'translation-wizard', 'tvd', 'vroni'<#,'vcpkg'#>)
# $Repositories = @('health-check', 'partner-portal', 'licence-api')
$Header = @('timestamp', 'username', 'type', 'file'<#,'colour'#>)
$WD = "_gource_log"
$Sorted = "sorted.annotated.txt"
Remove-Item -Force -Recurse $WD
Remove-Item -Force -Recurse $Sorted
New-Item -ItemType Directory -Path $WD
$Repositories | ForEach-Object {
$Repo = $_
$Log = "$WD/$Repo.txt"
Write-Output "Generating gource custom log for [$Repo] to [$Log]..."
gource --output-custom-log $Log $Repo
}
$Repositories | ForEach-Object {
$Repo = $_
$Log = "$WD/$Repo.txt"
$Annotated = "$WD/$Repo.annotated.txt"
Write-Output "Generating annotated repository names into [$Annotated]..."
Import-Csv -Delimiter '|' -Header $Header $Log | ForEach-Object {
$file = $_.file
$_.file = "=== [$Repo] ===$file"
return $_
} | ConvertTo-Csv -Delimiter '|' -UseQuotes Never | Select-Object -Skip 1 | Out-File $Annotated
}
Write-Output "Generating merged and sorted gource log to [$Sorted], this will take a sec..."
$Repositories | ForEach-Object {
$Repo = $_
$Annotated = "$WD/$Repo.annotated.txt"
Import-Csv -Delimiter '|' -Header $Header $Annotated
} | Sort-Object -Property @{ Expression = { $_.timestamp -as [int] } } | ConvertTo-Csv -Delimiter '|' -UseQuotes Never | Select-Object -Skip 1 | Out-File $Sorted
Write-Output "Done, run gource!"
# gource --seconds-per-day 0.1 --auto-skip-seconds 0.05 --max-file-lag 0.1 --hide filenames,root --highlight-users --user-scale 10 --user-font-size 20 --highlight-colour FF0000 $Sorted
# time gource $combined_log \
# -s 0.55 \
# -i 0 \
# -$RESOLUTION \
# --screen 2 \
# --highlight-users \
# --highlight-dirs \
# --file-extensions \
# --hide mouse,filenames \
# --background-colour $BG_COLOUR \
# --auto-skip-seconds .1 \
# --key \
# --stop-at-end \
# --camera-mode overview \
# --title "$TITLE" \
# --user-image-dir users \
# --output-framerate $FPS \
# --frameless \
# --output-ppm-stream - \
# | ffmpeg -y \
# -r $FPS \
# -f image2pipe \
# -vcodec ppm \
# -i - \
# -vcodec libx264 \
# -preset fast \
# -crf 18 \
# -threads 0 \
# -bf 0 \
# -pix_fmt yuv420p \
# -movflags \
# +faststart \
# $OUTPUT
# rm $combined_log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment