Tool for managing Git repositories in a Fossil monorepo
Project description
fitrepo
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., hotbox/master). The tool provides three commands: init to initialize the Fossil repository, import to add a new Git repository, and update to incrementally update an existing one.
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
-
Initialize the Fossil Repository
python fitrepo.py init
- Creates
monorepo.fossilif it doesn’t exist. - Creates an empty
fitrepo.jsonconfiguration file if it doesn’t exist.
- Creates
-
Import a Git Repository
python fitrepo.py import <git-repo-url> <subdir-name>
- Example:
python fitrepo.py import https://github.com/user/repo.git hotbox - Clones the Git repository, moves its files into the
hotboxsubdirectory, prefixes its branches (e.g.,hotbox/master), and imports it into the Fossil repository. - Stores configuration details in
fitrepo.json.
- Example:
-
Update an Existing Git Repository
python fitrepo.py update <subdir-name>
- Example:
python fitrepo.py update hotbox - Pulls the latest changes from the Git repository associated with
hotbox, reapplies the filters, and incrementally updates the Fossil repository.
- Example:
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.,
masterbecomeshotbox/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.x
- Git (with
git filter-repoinstalled; install viapip install git-filter-repo) - Fossil (installed and accessible from the command line)
Notes
- Run the tool in the directory where you want
monorepo.fossilto 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_rewriterstring 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fitrepo-0.1.0.tar.gz.
File metadata
- Download URL: fitrepo-0.1.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f38ca9716306a5c04ea13127777af171838690ed40bcfcd72499f35bfd0ff4c
|
|
| MD5 |
0f42b9c783f65372f0caa67d0edef224
|
|
| BLAKE2b-256 |
d8c36e30697f575c1f5e576a5aad63ac3de9be001efed781bc404984cf67e203
|
File details
Details for the file fitrepo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fitrepo-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48de052156d8441e8e440ed0b8e4e03ccaa059dea409ebd671f6cc42fcf3d474
|
|
| MD5 |
cf9f1ca3569eaa0bcc87103f46dffcfd
|
|
| BLAKE2b-256 |
cace46dbb3ce5414b081f9cb3c934de16005d0710529296c213b3db2bfe7217f
|