Skip to main content

A command-line tool for creating and managing coordinated patch series across multiple Git repositories

Project description

changes-roller

PyPI version Python License: MIT Documentation Code style: ruff CI codecov Security

Stop manually patching dozens of repositories. Automate it.

Changes-Roller is a command-line tool for creating and managing coordinated patch series across multiple Git repositories simultaneously.

Why changes-roller?

It's Tuesday morning, and you've just discovered a critical security vulnerability affecting 47 of your repositories. You know what comes next: hours of manual cloning, editing, committing, and reviewing. Your afternoon vanishes into mechanical git clone, git commit, git review while your actual development work waits.

changes-roller transforms this soul-crushing routine into a five-minute automation. Write your patch script once, then watch as it executes across all repositories in parallel. What used to consume your entire afternoon now runs while you grab coffee—with consistent changes, uniform commit messages, and organized code reviews.

Perfect for:

  • Security updates across multiple microservices
  • Dependency upgrades throughout your service ecosystem
  • API migrations affecting client libraries
  • License header updates for compliance
  • Configuration file standardization
  • Any scenario requiring identical changes across multiple repositories

Project Status

This project maintains high quality standards through automated testing and continuous integration:

  • 128 tests with >90% code coverage
  • Multi-platform testing across Python 3.10-3.13 on Linux, macOS, and Windows
  • Automated quality checks including strict type checking (MyPy), linting (Ruff), and security scanning (Bandit)
  • Pre-commit hooks enforce code quality before commits
  • Continuous security monitoring with pip-audit and dependency review

All pull requests undergo comprehensive automated testing to ensure reliability and maintainability.

How It Works

Configure once, execute everywhere. You provide the repositories to update and a script containing your changes. changes-roller handles everything else—cloning, patching, testing, committing, and submitting for review. Parallel execution means 50 repositories finish almost as quickly as one. Built-in error handling ensures you get clear feedback about any issues, while successful repositories continue processing.

Features

  • Apply patches to multiple Git repositories in parallel
  • Custom patch scripts with full repository access
  • Automated Git operations (clone, commit, stage)
  • Git branch switching - Apply changes to specific branches (e.g., stable branches)
  • Custom command execution - Run commands before/after applying changes
  • Dry-run mode - Preview operations without executing them
  • Automatic commit sign-off (Signed-off-by line)
  • Automatic git-review setup for Gerrit integration
  • Commit message templating with variables
  • Gerrit code review integration with topic grouping
  • Optional test execution before committing (e.g., tox -e pep8)
  • Clear progress reporting and error handling

Installation

# Install in development mode
pip install -e .

# Or install from source
pip install .

Requirements

  • Python 3.10 or higher
  • Git command-line client
  • git-review (optional, for Gerrit integration)

Quick Start

  1. Generate a configuration file:
roller init --output my-series.ini
  1. Create a patch script (my_patch.sh):
#!/bin/bash
# Example: Update a dependency version
sed -i 's/old-library==1.0/old-library==2.0/' requirements.txt
chmod +x my_patch.sh
  1. Edit the configuration file to specify your repositories and patch script:
nano my-series.ini
# Update the 'projects' list and 'commands' path
  1. Run the patch series:
roller create --config-file my-series.ini

Configuration

[SERIE] Section

Basic Options:

  • projects (required): Comma-separated list of Git repository URLs
  • commands (required): Path to executable patch script
  • commit_msg (required): Commit message template (supports {{ project_name }})
  • topic (optional): Code review topic name
  • commit (optional): Enable automatic commits (default: true)
  • review (optional): Enable Gerrit review submission (default: false)

Branch Switching Options:

  • branch (optional): Target branch to switch to before applying changes
  • create_branch (optional): Create branch if it doesn't exist (default: false)
  • stay_on_branch (optional): Don't return to original branch after completion (default: false)

Command Execution Options:

  • pre_commands (optional): Commands to run before applying changes (one per line)
  • post_commands (optional): Commands to run after committing (one per line)
  • continue_on_error (optional): Continue if commands fail (default: false)
  • dry_run (optional): Preview operations without executing (default: false)

[TESTS] Section

  • run (optional): Enable test execution (default: false)
  • blocking (optional): Fail if tests fail (default: false)
  • command (optional): Test command to run (default: tox)

Example: command = tox -e pep8 runs PEP8 checks before committing

Command-Line Options

roller init

Generate a template configuration file.

roller init [options]

Options:
  -o, --output PATH    Output file path (default: series.ini)
  -f, --force          Overwrite existing file
  --help               Show help message

roller create

Create a new patch series across multiple repositories.

roller create --config-file <path> [options]

Options:
  --config-file PATH        Path to configuration file (required)
  --config-dir PATH         Additional directory for config files
  -e, --exit-on-error       Exit immediately on first failure
  -v, --verbose             Enable verbose output

  # Branch switching
  --branch NAME             Target branch to switch to before applying changes
  --create-branch           Create branch if it doesn't exist (requires --branch)
  --stay-on-branch          Don't return to original branch after completion

  # Command execution
  --pre-command CMD         Command to execute before changes (repeatable)
  --post-command CMD        Command to execute after changes (repeatable)
  --continue-on-error       Continue if commands fail instead of stopping
  --dry-run                 Preview operations without executing them

  --help                    Show help message

Examples

Basic Usage

# Apply patch to multiple repositories
roller create --config-file my-series.ini

Branch Switching

# Apply changes to a specific branch
roller create --config-file security-fix.ini --branch stable/2024.2

# Multi-branch backport
for branch in stable/2024.1 stable/2024.2 stable/2025.1; do
  roller create --config-file fix.ini --branch $branch
done

With Commands

# Pull latest before patching, push after committing
roller create --config-file series.ini \
  --pre-command "git pull origin main" \
  --post-command "git push origin main"

# Validate before and after
roller create --config-file series.ini \
  --pre-command "pytest tests/" \
  --post-command "git push"

Dry Run

# Preview what would happen without executing
roller create --config-file series.ini --dry-run

With Testing

Configuration file with PEP8 validation:

[SERIE]
projects = https://github.com/org/repo1,
           https://github.com/org/repo2
commands = ./my-patch.sh
commit_msg = Fix styling in {{ project_name }}

[TESTS]
run = true
blocking = true
command = tox -e pep8

More Examples

See the examples/ directory for complete examples:

  • examples/dependency-update/ - Update a dependency across repos
  • examples/license-headers/ - Add license headers to source files
  • examples/config-migration/ - Migrate configuration files

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
ruff format .

# Linting
ruff check .

# Type checking
mypy roller/

Contributing

We welcome contributions! Please see our contributing guidelines and community standards:

License

See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

changes_roller-0.1.0.tar.gz (75.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

changes_roller-0.1.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file changes_roller-0.1.0.tar.gz.

File metadata

  • Download URL: changes_roller-0.1.0.tar.gz
  • Upload date:
  • Size: 75.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for changes_roller-0.1.0.tar.gz
Algorithm Hash digest
SHA256 77208a084650769fdb846afb79298a69afe5e3c45ebd0eebe017be8eaa12f1a3
MD5 722a8796f65871e02ab8c4571bbe19db
BLAKE2b-256 cd30de6d92ef4894bdaa9fb818e1e9865887cd2ab45831263dbe867fcde26ddf

See more details on using hashes here.

File details

Details for the file changes_roller-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: changes_roller-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for changes_roller-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb95495e8318aa8ea324df72776983ccdb235a3b6666900c2fd4f3816b31e76
MD5 74e722ac034416cc1331a4eaf39d4ceb
BLAKE2b-256 a69c26b7dda4d9a7975c0e5535f59f57445b64632d93bea2b0f6e45217bfa6a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page