Skip to main content

Tool for managing Git repositories in a Fossil monorepo

Project description

Fitrepo - Fossil Import Tool

Fitrepo is a command-line tool for managing Git repositories inside a Fossil repository.

Usage

Initializing a New Repository

pip install fitrepo
uv tool run fitrepo --help

How to Use

Run the script from the directory where you want the Fossil repository (monorepo.fossil) and configuration file (fitrepo.json) to reside.

Commands

  1. Initialize the Fossil Repository

    uv tool run fitrepo init
    
    • Creates monorepo.fossil if it doesn’t exist.
    • Creates an empty fitrepo.json configuration file if it doesn’t exist.
    • Supports: --help, --version, --verbose, --quiet, --config FILE, --force, --dry-run
  2. Import a Git Repository

    uv tool run fitrepo import <git-repo-url> <subdir-name>
    
    • Example: uv tool run fitrepo import https://github.com/user/repo.git hotbox
    • Clones the Git repository, moves its files into the hotbox subdirectory, prefixes its branches (e.g., hotbox/master), and imports it into the Fossil repository.
    • Stores configuration details in fitrepo.json.
    • Supports: --help, --version, --verbose, --quiet, --config FILE, --no-fetch, --force, --dry-run
  3. Update an Existing Git Repository

    uv tool run fitrepo update <subdir-name>
    
    • Example: uv tool run fitrepo update hotbox
    • Pulls the latest changes from the Git repository associated with hotbox, reapplies the filters, and incrementally updates the Fossil repository.
    • Supports: --help, --version, --verbose, --quiet, --config FILE, --no-fetch, --no-push, --force, --dry-run

Command-line Options

The tool supports several global options that can be used with any command:

  • --help: Show help message and exit.
  • --version: Show the version of the tool and exit.
  • --verbose: Enable verbose output.
  • --quiet: Suppress non-error messages.
  • --config FILE: Specify a custom configuration file.
  • --no-fetch: Do not fetch the latest changes from the remote repository.
  • --no-push: Do not push changes to the remote repository.
  • --force: Force the operation to proceed even if there are warnings or errors.
  • --dry-run: Show what would be done without making any changes.

Configuration File (fitrepo.json)

The tool maintains a fitrepo.json file to track imported repositories. Example content after importing a repository:

{
    "hotbox": {
        "git_repo_url": "https://github.com/user/repo.git",
        "git_clone_path": ".git_clones/hotbox",
        "git_marks_file": ".marks/hotbox_git.marks",
        "fossil_marks_file": ".marks/hotbox_fossil.marks"
    }
}

Features

  • Subdirectory Organization: Each Git repository’s files are placed in a unique subdirectory within the Fossil repository.
  • Branch Prefixing: Branches are renamed with the subdirectory name as a prefix (e.g., master becomes hotbox/master).
  • Incremental Updates: Uses marks files to ensure only new changes are imported during updates.
  • Error Handling: Provides informative error messages for common issues (e.g., duplicate subdirectory names, command failures).
  • User Feedback: Logs progress and errors to the console.

Requirements

  • Python 3.12+
  • Git
  • git-filter-repo (automatically installed as a dependency)
  • Fossil (installed and accessible from the command line)

Notes

  • Run the tool in the directory where you want monorepo.fossil to reside.
  • The tool assumes .git_clones/ and .marks/ directories are subdirectories of the current working directory.
  • Only branches are prefixed; tags retain their original names. To prefix tags, modify the refname_rewriter string in the code.

This implementation fulfills your intention to create a CLI tool that seamlessly manages multiple Git repositories within a single Fossil repository, with isolated subdirectories and prefixed branches.

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

fitrepo-0.1.43.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

fitrepo-0.1.43-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file fitrepo-0.1.43.tar.gz.

File metadata

  • Download URL: fitrepo-0.1.43.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for fitrepo-0.1.43.tar.gz
Algorithm Hash digest
SHA256 3dfdbbe9b3535bd0ada5434332f60e89873a7c9304b6df050e68c551a5b65199
MD5 910aa11c8d51820b03d579037b7bba7d
BLAKE2b-256 65709c73129d9cc505b9597afc1a355f6447dc1becd23b14f3417a51f069325f

See more details on using hashes here.

File details

Details for the file fitrepo-0.1.43-py3-none-any.whl.

File metadata

  • Download URL: fitrepo-0.1.43-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for fitrepo-0.1.43-py3-none-any.whl
Algorithm Hash digest
SHA256 8971539cda61f43b87a36b6c5fef9d0a67a8908a632ceab2f78f30f8dafcde52
MD5 ec90613f9e6ab1566ce3e4e8b4919ca2
BLAKE2b-256 f395d7fc0abff3fc86b54cd7725612c76e30489431438ee833f4d92adc52c19d

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