HTTP url for heads of files

Mads Kiilerich mads at kiilerich.com
Thu Jan 6 11:11:52 CST 2011


On 01/06/2011 05:24 PM, Alex Black wrote:
> I'd like to access the heads of files on a given branch via a url, e.g.
> http://host/hg/<branch>/files/project/src/main/java/com/acme/package/myfile.java
>
> This way anyone or any application could access the latest version of a
> file in a repository via HTTP.
>
> I've looked a bit and it doesn't look like hg serve has this feature,
> instead all urls have a changeset ID on them.  Is there a way to do this
> with hg serve, or are there addons or 3rd party tools that might support
> this?

See "hg help revisions".

Mercurial by default identifies changesets with 12 characters of hash. 
That is a good and for all practical purposes unique identifier.

(Almost) all other ways of identifying changesets can be used in URLs 
too - including branch names. Just edit the URL, almost exactly as you 
suggested.

Navigating away from such URLs will however use unique stable URLs.

/Mads


More information about the Mercurial mailing list