Bidirectional sync with git in practice?
(1.1) By hanche on 2022-03-28 10:37:15 edited from 1.0 [link] [source]
I do follow some number of git-based software projects. So far, I am just using a git clone to keep up. I wonder how practical it is to use fossil instead?
The Import And Export page has a section Bidirectional Synchronization at the end, explaining how to synchonize a git repository with fossil. It does look a bit awkward, but I suppose it is easily scriptable.
My question: Does anybody do this in practice, just to use fossil in order to keep up with a git repo? How does it work for you? What are the advantages and disadvantages of doing it this way, compared to just using git? I ask as someone who is fairly conversant with basic git operations. Not an expert by a long shot, but well past the beginning stage.
(edit: fixed typo in the title)
(2) By Alfred M. Szmidt (ams) on 2022-06-28 18:51:10 in reply to 1.1 [source]
Hi,
I do it for a few repositories; it works well until someone does a rebase. :-/
Here are my notes for how I keep track. The only advantage for me is that of self-hosting, and not having to use git.
4 Mirroring repositories between Git and Fossil
***********************************************
Fossil requires two "mark" (one for Git, one for Fossil) files to keep
track of what objects it has synchronised. These files are keept as
unversioned files in the fossil repository. REPO is the name of the
repository.
4.1 Initial exports
===================
The 'fossil export --git' command is supposedly deprecated
To make an initial export of a Fossil repository to a new git
repository:
git init
fossil export --git --export-marks "REPO.fossil-marks" REPO.fossil | \
git fast-import --export-marks="REPO.git-marks"
Similar, for an initial export of a Git repository to a new Fossil
repository ('REPO.fossil' is created by the 'fossil' command).
git fast-export --all --export-marks="REPO.git-marks" | \
fossil import --git --export-marks "REPO.fossil-marks" \
REPO.fossil
In both cases, add the two mark files to the Fossil repository:
fossil uv add REPO.git-marks REPO.fossil-marks -R REPO.fossil
4.2 Updating
============
For bi-directional synchronization between a Fossil repository and a git
repositry execute both import steps below.
Before starting, export the two mark files:
fossil uv export REPO.git-marks REPO.git-marks -R REPO.fossil
fossil uv export REPO.fossil-marks REPO.fossil-marks -R REPO.fossil
Importing changes from fossil into an existing git repository; i.e.
update the git repository with new changes from a fossil repository:
fossil sync REPO.fossil # Fetch upstream changes.
fossil export --git --import-marks "REPO.fossil-marks" --export-marks "REPO.fossil-marks" REPO.fossil | \
git fast-import --import-marks="REPO.git-marks" --export-marks="REPO.git-marks"
Importing changes from git into an existing fossil repository; i.e.
update the fossil repository with changes from a git repository:
cd REPO.git
git fetch --all # Fetch upstream changes.
git fast-export --all --import-marks="REPO.git-marks" --export-marks="REPO.git-marks" | \
fossil import --git --import-marks "REPO.fossil-marks" --export-marks "REPO.fossil-marks" \
--incremental REPO.fossil
To complete the synchronization, update the two mark files in the fossil
repository. Do not forget to 'fossil sync' and/or 'git push' as
appropriate.
fossil uv add REPO.git-marks REPO.fossil-marks -R REPO.fossil
4.3 Issues
==========
If you get the following fatal message, pass '--signed-tags=warn-strip'
to 'git fast-export'.
fatal: encountered signed tag <SHA>; use --signed-tags=<mode> to handle it
If you get the following error, then pass the 'USER' variable to the
command 'USER=<you> fossil'.
Cannot figure out who you are! Consider using the --user
command line option, setting your USER environment variable,
or setting a default user with "fossil user default USER".
cannot determine user