Skip to content

Instantly share code, notes, and snippets.

@andrewiankidd
Created September 5, 2024 13:57
Show Gist options
  • Save andrewiankidd/abdd748ce04b0e5a639c3224333cf733 to your computer and use it in GitHub Desktop.
Save andrewiankidd/abdd748ce04b0e5a639c3224333cf733 to your computer and use it in GitHub Desktop.
[Gource][PowerShell] Visualizing Multiple Repositories
[gource]
auto-skip-seconds=5
seconds-per-day=1
time-scale=4.0
param (
$GitDir = @("C:\git"),
$RepoNames = @(
"repo1",
"repo2"
),
$Branched = $true
)
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$workingDir = "$($GitDir)\.gource"
$timeStamp = Get-Date -Format yyyymmddhhmmss
$combinedLogPath = "$($workingDir)\$($timeStamp).txt"
$outputPath = "$($GitDir)\$($timeStamp)$(if($Branched){'.branched'})"
if (-not (Test-Path -Path $workingDir))
{
New-Item -ItemType Directory -Path $workingDir -Force
}
$RepoNames | ForEach-Object {
$repoName = $_
$repoPath = "$($GitDir)\$($repoName)"
$logPath = "$($workingDir)\$($timeStamp).$($repoName).txt"
Write-Host "Scanning directory '$($repoName)'"
Write-Host "gource --output-custom-log `"$logPath`" `"$repoPath`""
& gource --output-custom-log $logPath $repoPath
if ($Branched)
{
(Get-Content -Path $logPath) -replace '^(.+)\|', "`$1|/$($repoName)" | Set-Content -Path $logPath
}
}
Write-Host "Get-Content -Path `"$($workingDir)\$($timeStamp).*.txt`""
Get-Content -Path "$($workingDir)\$($timeStamp).*.txt" | Where-Object { $_ } | Sort-Object { $($_.Split("|")[0]) } | Set-Content $combinedLogPath
Write-Host "& gource --load-config $($GitDir)\gource.ini --output-framerate 60 --output-ppm-stream output.ppm --path $combinedLogPath"
& gource --load-config "$($GitDir)\gource.ini" --output-framerate 60 --output-ppm-stream "$outputPath.ppm" --path $combinedLogPath
ffmpeg.exe -y -r 60 -f image2pipe -vcodec ppm -i "$outputPath.ppm" -vcodec wmv1 -r 60 -qscale 0 "$outputPath.wmv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment