Add --output-start-date and --output-stop-date for segment rendering
Summary
This PR adds two new command-line options that enable segment rendering - the ability to render only a specific date range while still simulating the full repository history.
New Options
-
--output-start-date "YYYY-MM-DD hh:mm:ss +tz"- Start outputting frames from this date -
--output-stop-date "YYYY-MM-DD hh:mm:ss +tz"- Stop outputting frames after this date
Key Difference from Existing Options
The existing --start-date and --stop-date options filter log entries (commits), which means:
- Files that existed before
--start-datewon't appear - The visualization starts from scratch at the specified date
The new --output-start-date and --output-stop-date options simulate the full history but only output frames within the specified range:
- All files and contributors are in their correct positions
- The tree structure reflects the complete repository state at that point in time
- Only the rendering output is filtered, not the simulation
Motivation / Use Case
When rendering visualizations for large repositories with years of history, it's often desirable to produce weekly or monthly video segments rather than one massive video.
Current approach (inefficient):
# Render January - processes ALL history, outputs ALL frames
gource --start-date "2024-01-01" --stop-date "2024-01-31" -o jan.ppm
# Render February - starts from scratch, files missing
gource --start-date "2024-02-01" --stop-date "2024-02-28" -o feb.ppm
With this PR (efficient segment rendering):
# Render January segment - full history simulated, only Jan frames output
gource --output-start-date "2024-01-01" --output-stop-date "2024-01-31" -o jan.ppm
# Render February segment - full history simulated, only Feb frames output
gource --output-start-date "2024-02-01" --output-stop-date "2024-02-28" -o feb.ppm
Each segment shows the repository in its correct state, and segments can be concatenated into a seamless video.
Implementation
Files Modified
-
src/gource_settings.h- Added new member variables:-
output_start_timestamp,output_stop_timestamp(time_t) -
output_start_date,output_stop_date(std::string)
-
-
src/gource_settings.cpp- Added:- Argument type definitions
- Default value initialization
- Parameter parsing (reusing existing
parseDateTimefunction) - Help text
-
src/gource.cpp- Modifiedupdate()to check date range beforeframeExporter->dump():- Skip frames before
output_start_timestamp - Skip frames after
output_stop_timestampand setstop_position_reached
- Skip frames before
-
README.md- Added documentation for both new options
Design Decisions
- Follows the same date parsing format as existing
--start-date/--stop-date - Uses
stop_position_reachedflag when passingoutput_stop_dateto properly exit when using--stop-at-end - Minimal code changes - reuses existing infrastructure
- Backward compatible - no changes to existing behavior
Testing
Tested locally on macOS with a sample repository:
./gource . --output-start-date "2011-10-01" --output-stop-date "2011-10-31" \
--output-framerate 60 --seconds-per-day 0.1 --stop-at-end -o - | \
ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 output.mp4
Successfully produced a video showing only October 2011 activity with the full repository tree structure intact.