- watching fossil-path with inotify(7) for IN_MODIFY events (needs pyinotify for that)
- checking for new revisions in fossil (source) repo against tip of a git
- comparing these by timestamps, which are kept in perfect sync (by fossil-export as well)
- exporting revisions from fossil as a full artifacts (blobs), importing these into git via git-fast-import
It's also capable to do oneshot updates (in which case it doesn't need anything but python-2.7, git and fossil), bootstrapping git mirrors as new fossil repos are created and catching-up with their sync on startup.
While the script uses quite a low-level (but standard and documented here and there) scm internals, it was actually very easy to write (~200 lines, mostly simple processing-generation code), because both scms in question are built upon principles of simple and robust design, which I deeply admire.
usage: fossil_echo [-h] [-1] [-s] [-c] [-b BRANCH] [--dry-run] [-x EXCLUDE] [-t STAT_INTERVAL] [--debug] fossil_root git_root Tool to keep fossil and git repositories in sync. Monitors fossil_root for changes in *.fossil files (which are treated as source fossil repositories) and pushes them to corresponding (according to basename) git repositories. Also has --oneshot mode to do a one-time sync between specified repos. positional arguments: fossil_root Path to fossil repos. git_root Path to git repos. optional arguments: -h, --help show this help message and exit -1, --oneshot Treat fossil_root and git_root as repository paths and try to sync them at once. -s, --initial-sync Do an initial sync for every *.fossil repository found in fossil_root at start. -c, --create Dynamically create missing git repositories (bare) inside git-root. -b BRANCH, --branch BRANCH Branch to sync (must exist on both sides, default: trunk). --dry-run Dump git updates (fast-import format) to stdout, instead of feeding them to git. Cancels --create. -x EXCLUDE, --exclude EXCLUDE Repository names to exclude from syncing (w/o .fossil or .git suffix, can be specified multiple times). -t STAT_INTERVAL, --stat-interval STAT_INTERVAL Interval between polling source repositories for changes, if there's no inotify/kevent support (default: 300s). --debug Verbose operation mode.