Skip to main content

Recomi -- The Repository Collection Mirror

Recomi is a batch-orientated tool for keeping local collections of git repositories mirroring their remote upstream counterparts.

Each "collection" is a directory that contains repositories. Normally the repositories would be --mirror ones, but this works with ordinary clones too.

At its simplest this tool is little more than git fetch in a for loop. But what it also offers is a structured way to find out if there are any new repositories upstream and then automatically clone them.

Usage

$ recomi fetch /path/to/collection1 /path/to/collection2...
$ recomi gc /path/to/collection1 /path/to/collection2...
$ recomi fsck /path/to/collection1 /path/to/collection2...
$ recomi clone /path/to/collection1 /path/to/collection2...
$ recomi mirror /path/to/collection1 /path/to/collection2...

The mirror command is equivalent to running fetch then gc then clone for each collection.

Installation

To install the last stable version into your current virtualenv run:

$ pip install recomi

Alternatively you can get the current development version with:

$ pip install git+https://github.com/pscl4rke/recomi.git

Configuration

The fetch, gc and fsck commands need no configuration.

For clone you need to create a config file inside each collection with the name recomi.ini. The bare minimum contents is:

[clone]
list = shell-command argument1 argument2...
url = git://example.com/example/{name}.git

Use list to define a shell command that will communicate with the upstream source and return a list of repositories (one per line).

Use url to turn each listed repository into a clonable SSH/URL pattern. It will replace {path} with the full path that list returned, and will replace {name} with just the name part.

Also use type set to either working, mirror, mirror-ff or bare to describe what type of clone to make. It is optional and defaults to mirror. Using mirror-ff is experimental: it rewrites the fetch ref from +refs/*:refs/* to refs/*:refs/* to prevent forced updates and ensure history is preserved.

By default recomi will warn you (on stderr) when it clones a new repository. Set warn to false to clone without a warning.

If the output of list contains paths (e.g. foo/bar.git) Recomi's default behaviour is to mimic git clone and it will only use the basename (resulting in bar or bar.git getting cloned). Setting onlybase to false will include the path prefix in the cloned destination, with slashes converted to double underscores (so foo__bar or foo__bar.git will be locally created). This is useful for hosting forges that file repositories under username or organisation subsections, as the subsections might have duplicate names.

Another example:

[clone]
list = ssh mygithost list | grep -v bigrepo
url = mygithost:{name}.git
type = working

Usage with Cron

Note that recomi distinguishes between routine output, which is sent to stdout, and errors/warnings, which are sent to stderr. Thus you can use a shell pipeline or redirection to send stdout to a log somewhere while letting cron collect up stderr and send it as an email:

8 4 * * * recomi fetch /path/to/dir | logger -t recomi-dir

Limitations

  • Recomi is deliberately only interested in pulling from upstream repositories in an unattended manner. If you would like interactive tooling to manage both pulling and pushing repositories then look into whether myrepos or gitbatch might be better suited to you.
  • Recomi currently doesn't handle submodules.
  • Recomi currently doesn't manage hook scripts.
  • Recomi may be vulnerable to forced updates unless mirror-ff is used.
  • Recomi is generally case-sensitive. Many collection hosts will consider foobar and FooBar the same and allow for smooth renaming, but Recomi will detect this as a new repository and clone from scratch.

Debugging

By running make dev you can create a development virtualenv, and can run ./dev/venv/bin/recomi to test out the program.

Running make test will run the test suite within the development virtualenv.

By setting the environment variable RECOMI_DRY_RUN=True you can see which git commands would have been run without actually running them.

By setting the environment variable RECOMI_VERBOSE=True you can see more detailed information about what it is trying to do.

Licence

This software is licensed under the GPLv3.

Release files for recomi 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for recomi 1.2.3
File Size Uploaded
recomi-1.2.3.tar.gz 20.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for recomi 1.2.3
File Interpreter ABI Platform
recomi-1.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 40.7 kB

Release files / recomi-1.2.3.tar.gz

Download URL recomi-1.2.3.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9830e278e9eebfff5aa64afb5a998be583d6513a301c6497cf0a80937b7ff342
BLAKE2b-256 checksum
How to use checksums
815ec6be88ec826a301400db44b0af4e4a7d2f4bf98b53934ebc7e3e008eeb5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / recomi-1.2.3-py3-none-any.whl

Download URL recomi-1.2.3-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
210b42c57e938a8f117a053a57d46b39290e761c0b6b13f3dc9e45668c46aa25
BLAKE2b-256 checksum
How to use checksums
d7d6907c5e75be9b651229f9c532cdeae2079ab60cc69572c3a6ffb94c0237f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page