Fitrepo - Fossil Import Tool
This tool manages the import and incremental update of multiple Git repositories into a single Fossil repository, effectively creating a monorepo. Each Git repository is organized into its own subdirectory within the Fossil repository, and its branches are prefixed with the subdirectory name (e.g., subrepo/master).
Usage
Installation
pip install fitrepo
How to Use
Run the script from the directory where you want the Fossil repository (fitrepo.fossil) and configuration file (fitrepo.json) to reside.
Commands
-
Initialize the Fossil Repository
uv tool run fitrepo init
- Creates
fitrepo.fossilif it doesn't exist. - Creates an empty
fitrepo.jsonconfiguration file if it doesn't exist. - Supports:
-v/--verbose,-f/--fossil-repo,-c/--config,-g/--git-clones-dir,-m/--marks-dir,--fwd-fossil-open,--fwd-fossil-init,--fwdfossil
- Creates
-
Import a Git Repository
uv tool run fitrepo import <git-repo-url> <subdir-name>
- Example:
uv tool run fitrepo import https://github.com/user/subrepo.git subrepo - Clones the Git repository, moves its files into the
subreposubdirectory, prefixes its branches (e.g.,subrepo/master), and imports it into the Fossil repository. - Stores configuration details in
fitrepo.json. - Supports the same options as the
initcommand.
- Example:
-
Update an Existing Git Repository
uv tool run fitrepo update <subdir-name>
- Example:
uv tool run fitrepo update subrepo - Pulls the latest changes from the Git repository associated with
subrepo, reapplies the filters, and incrementally updates the Fossil repository. - Supports the same options as the
initcommand.
- Example:
-
List Imported Repositories
uv tool run fitrepo list
- Lists all the Git repositories that have been imported into the Fossil repository.
- Shows the subdirectory name and Git repository URL for each imported repository.
- In verbose mode, shows additional details like clone path and marks files.
Command-line Options
The tool supports several global options that can be used with any command:
-v/--verbose: Enable verbose output.-f/--fossil-repo FILE: Specify a custom Fossil repository file (default:fitrepo.fossil).-c/--config FILE: Specify a custom configuration file (default:fitrepo.json).-g/--git-clones-dir DIR: Specify a custom Git clones directory (default:.fitrepo/git_clones).-m/--marks-dir DIR: Specify a custom marks directory (default:.fitrepo/marks).--fwd-fossil-open ARGS: Forward arguments to thefossil opencommand.--fwd-fossil-init ARGS: Forward arguments to thefossil initcommand.--fwdfossil ARGS: Forward arguments to all fossil commands (deprecated).--version: Show the version of the tool and exit.--help: Show help message and exit.
Configuration File (fitrepo.json)
The tool maintains a fitrepo.json file to track imported repositories. Example content after importing a repository:
{
"name": "project_name",
"repositories": {
"subrepo": {
"git_repo_url": "https://github.com/user/repo.git",
"git_clone_path": ".fitrepo/git_clones/subrepo",
"git_marks_file": ".fitrepo/marks/subrepo_git.marks",
"fossil_marks_file": ".fitrepo/marks/subrepo_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.,
masterbecomessubrepo/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.
- Flexible Configuration: Allows customization of file paths and Fossil arguments.
Requirements
- Python 3.9+
- 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
fitrepo.fossilto reside. - The tool creates
.fitrepo/git_clones/for Git repositories and.fitrepo/marks/for marks files. - Only branches are prefixed; tags retain their original names.
- Use
-v/--verbosefor detailed output during operations. - When specifying arguments with
--fwdfossilthat begin with a dash, use the equals sign format to avoid shell interpretation issues (e.g.,--fwdfossil="-f").
Advanced Usage
Forwarding Arguments to Fossil Commands
You can pass specific arguments to fossil commands:
# Forward '-f' argument to 'fossil open' command
uv tool run fitrepo init --fwd-fossil-open="-f"
# Forward arguments to 'fossil init' command
uv tool run fitrepo init --fwd-fossil-init="--template /path/to/template"
Using Nested Subdirectories
You can import repositories into nested subdirectories:
uv tool run fitrepo import https://github.com/user/repo.git libs/common
This will clone the repository to libs/common/repo subdirectory and prefix branches with libs/common/repo/.
Metadata
Release files for fitrepo 0.1.432
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fitrepo-0.1.432.tar.gz | 10.6 kB | Without provenance | Details for fitrepo-0.1.432.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fitrepo-0.1.432-py3-none-any.whl | Python 3 | none | any | Details for fitrepo-0.1.432-py3-none-any.whl |
Total release size: 22.2 kB
Release files / fitrepo-0.1.432.tar.gz
| Download URL | fitrepo-0.1.432.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afafff4984bc25f43f01198a59bac10a865b03d723ccffd3b6253c141af869a5
|
|
BLAKE2b-256 checksum How to use checksums |
48c0f4871d47925294b0babf13cbfae00ec4a8415c962e79427940eb1e1f413f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / fitrepo-0.1.432-py3-none-any.whl
| Download URL | fitrepo-0.1.432-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97612ee58089b835219e1ade3ea36253c0a660bb1fa9b9bb797c47d09c046d20
|
|
BLAKE2b-256 checksum How to use checksums |
e29f7b874cd6e6bb25eec52645e4bd83fcd2fbaf99e59964e0763eacc834e6ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for fitrepo 0.1.432
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.