This is works-for-me ... not as well as I'd like it to work for others ...
Bug Tracker; https://codeberg.org/paintgoblin/shugits/issues
Serving Mercurial from Git Servers
Shugits allows you to serve Mercurial repositories from a Forejo Git server. A full Mercurial repostory is kept on the server, preserving branch names (et al) correctly. Previously something like this was done by "Kiln" which vanished after becoming only-git and trying to compete with MicroSoft's GitHub. Shugits fills the gap by enabling seamless Mercurial projects to be exposed to existing Git-based infrastructure.
... and it's WaFeEz than the Mercurial tools I've tried (and failed) to setup on my Pi ...
How It Works
Shugits operates as a custom (ApacheSSHd) SSH server within a (Docker) container, responding to Mercurial commands. It mirrors the Mercurial repository to git through the hg-git extension on the server. (... and corrects the head names) From the user's perspective, SSH connections behave as if they are operating on Mercurial, while HTTP connections remain Git-oriented. The user interfaces and project administration settings remain unchanged.
How To
Install the whole system as intended
-
clone the project and run
shugits.sbt/ $ sbt assemblyto get the binary jar and copy it into the right place- do this one your workstation
- someday ... i should add a CI job to automate this ...
- ... or something like ...
λ java -jar ../sbt-launch.jar assembly
-
copy the
shugits.sbt/composed/to the server asshugits-live/- ... actually ... you can use whatever name you want - but - this guide is was easier if i pretend it has to
be
shugits-live/
- ... actually ... you can use whatever name you want - but - this guide is was easier if i pretend it has to
be
-
make the
shugits-live/target/target/folder usable to the shugits containershugits-live/ $ sudo chgrp systemd-journal target/target/shugits-live/ $ chmod g+=rwx target/target/
-
setup forgejo and your account
- add any DNS entries
shugits-live/ $ docker-compose up --build forgejoand leave it running in a separate window for now- set the hostname to whatever is sensible
- use port 5190 for git's ssh in the forgejo config
- make yourself an admin account
- setup your (desktop) public ssh key (for testing)
-
create an access token key
- this allows shugits to take control
- sign in, click your profile, open
Settings>Applications> select all r+w permissions and thenGenerate token- weirdly - this is done with your admin account and not something system-wide
- in theory ... it could work with less permissions, but, i lack the patience to chekc that
- save the token to a text file
shugits-live/target/target/shugits.token- ... right next to
shugits-live/target/target/shugits.jar... - i've used WinSCP's text weditor fine for this
- ... right next to
-
launch the shugits container
shugits-live/ $ docker-compose up --build shugitsand leave it running for now
- this could take awhile
-
create some project on forgejo, then, push to it from hg
- you'll have to do the normal fingerptin stuff and ssh into the host before THgW will work right (sorry)
- you'll need to change the ssh from
.../git@...to.../hg@...- ... so ...
ssh://git@sg.peterlavalle.com:5190/peter/shugits.gitbecomesssh://hg@sg.peterlavalle.com:5190/peter/shugits.git
- ... so ...
-
(finally) kill and restart the containers to run on their own
- CTRL+C both the
forgejoandshugitscontainers - run
shugits-live/ $ docker-compose up -d- shugits will die; sorry
- navigate to your forgejo page to see if it's up and running yet
- re-run
shugits-live/ $ docker-compose up -dand see thatshugitsis up again
- CTRL+C both the
-
(optional) setup the git project to mirror to somewhere offsite
- https://codeberg.org/
- https://gitlab.com/
- https://sr.ht/
- maybe? https://bitbucket.org/product
- i dunno; https://heptapod.net/
- ... i guess ... https://github.com/
cron backups
(wip - i need to create and test the procedure for this)
Reset a password from the command line
- login to the host
- find the container id with
docker ps - bash into the container with
docker exec -it 4edeadcafe /bin/bash - change to the git user
su git - list the forgejo accounts
gitea admin user list - change the password
gitea admin user change-password -u plavalle -p foobar123 - login and set a real password!
Issues
There's a public issue tracker at https://codeberg.org/paintgoblin/shugits/issues I've stopped tracking my TODOs publicly since (1) I'm working on my own (2) I have like zero motivation to finish anything once it's in a schedule.
Development
The use of a standard forgejo image negates the need for development of that image. The image must be running (however) for the shugits server to operate, then the java program can be started from IDEA, then ... ugghh; just recall these future Peter ...
- shell
shugits.sbt/composed/ $ docker-compose up --build forgejo - browse;
http://localhost:3000/ - clear;
shugits.sbt/target/namesake-repos - main;
peterlavalle/shugits/Main.scala - push;
hg push -r3 --new-branch ssh://hg@localhost:5190/peter/shugits.git
out to hg!
need to get log messages (et al) out to the hg user. need to keep other messages "less public."
i think that it's a little better than it was before. not sure what to do with TheHook - maybe it's fine, maybe it should be bash ... maybe it ... IDK