Hosting a git clone of the Octave repository

@mtmiller was it possible to update your git-mirror again and to describe your setup? You mentioned that you use git-cinnabar. So far I did not find the right tweaks to only push the default and stable branch. Then I can host an automatically updated git mirror, too.

If you are further interested, you might consider moving your git mirror in some Octave GitHub organization?

Thank you :slightly_smiling_face:

After many trials and errors, I seem to have figured out a way to achieve this task.

  1. “git-cinnabar” was a dead end for this project. If someone knows how to get it right, I am interested :slightly_smiling_face:

  2. Using hg-git came already very close and was very straight forward. The basic idea is to work in a Mercurial repository and convert to git if necessary.

    With this Mercurial extension installed, you can edit .hg/hgrc:

    [paths]
    default = https://www.octave.org/hg/octave
    github = git+ssh://git@github.com:gnu-octave/octave.git
    

    and call hg push github. Works all quite, but the resulting repository is 2 GB in size (the original Mercurial repository weights about 240 MB.

git-remote-hg to the rescue

The opposite direction to “hg-git” goes “git-remote-hg”. The basic idea is to work in a git repository that embraces a Mercurial one.

With the git extension installed:

git clone "hg::https://www.octave.org/hg/octave"

# Use compression to shrink 2 GB to 200 MB.
git gc --aggressive

git remote add github git@github.com:gnu-octave/octave.git

# Default "master" branch is immediately available.
# Create local "stable" branch.
git checkout branches/stable
git branch -m stable

# Push with release tags.
git push --tags github

Now to automatically keep the Mercurial and GitHub repos in sync, I established a 5 minutes cron-job with

git pull origin                # https://www.octave.org/hg/octave"
git push github master stable  # https://github.com/gnu-octave/octave

Final note: also this approach suffers from the lack of object compression in the git repositiory. But in contrast to the “hg-git” approach, one can easily compress the repository locally using the git gc command.

Hey @siko1056, sorry for the late reply, I haven’t been computing much in the last month or so. I don’t have any specific steps written down to reproduce my setup, but as I recall getting started with git-cinnabar was fairly easy. Once it’s working, it is a simple matter of clone, pull, and push, similar to yours.

The primary advantage of git-cinnabar in my understanding is that it’s the best (only?) two-way bridge to allow pushing from a git branch to a hg remote repository.

1 Like