Writing a server for mercurial

Gregory Szorc gregory.szorc at gmail.com
Thu Nov 20 16:27:06 UTC 2014


On 11/20/14 7:32 AM, James Wendel wrote:
> I have been considering writing a server to host mercurial repos.
> Reading around, hgweb and hg-serve already do a good job at serving
> normal hg repos.  It also looks like other servers out there
> (scm-manager and others) may just wrap hgweb and add functionality
> on-top of it.
>
> Why I would like to do it:
> 1) To create a mercurial focused repo server.
> 2) Focusing on server-only operations may allow for performance
> improvements over hgweb.
> 3) To learn and for fun (I'd be doing it in a different language).
>
> So my question: is this worth pursing?
>
> Reading over the specs, implementing this in anything other than python
> would require me to implement the WireProtocol and BundleFormat to be
> compatible with normal HG clients, along with all the .  How I store the
> data behind that would be totally up to me, as long as the results were
> compatible with what HG clients expect. This could allow for different
> storage strategies that are more focused on acting as a server only.
>
> I'd prefer to do a clean room implementation of it so I could release it
> under BSD license, but I am not opposed to releasing under GPL if
> required (as the docs don't seem detailed enough to really create a
> compatible server).  Looking at HGLab, it looks like they just
> reimplemented hg core in C# and released it as GPL2, then built their
> product on-top of that.  So that could probably work for me as well.
>
> (I doubt I'll actually make progress on this to anything usable, just
> digging into it.  Any feedback is appreciated.)

What is the problem you are trying to solve?

There are some very large (not "normal") Mercurial servers out there 
using the default server implementation. Mozilla has a few thousand 
repos on hg.mozilla.org using a rather vanilla Mercurial configuration. 
And that works fine for everything except repositories with 10,000+ 
heads (making Mercurial scale that far will require wire protocol and 
discovery enhancements that are arguably not worth doing at this stage).

Speaking for myself, I'd say the existing protocol and storage 
availabilities are OK. A custom protocol layer implementation in "not 
Python" IMO won't buy you much until you swap out everything underneath. 
And that would be a huge undertaking. To my knowledge, the only group 
that has done that is Google Code and HgLab. I think extensions 
providing a custom storage backend while still using the existing 
Mercurial stack (like hgsql) should be sufficient for most needs.

IMO we could use a better high-level repository management tool and 
something to manage things like SSH keys and access. Kallithea *could* 
be that thing. Although some may argue that a headless version of 
Kallithea doing just repo management is what is really wanted.



More information about the Mercurial mailing list