RFC: hgweb enhancements

Mads Kiilerich mads at kiilerich.com
Fri Apr 19 13:44:31 CDT 2013

On 04/19/2013 07:57 AM, Tim Delaney wrote:
> I've got a pile of enhancements I've made to hgweb locally via 
> template modifications + a monkey-patching extension (so I can easily 
> let the whole team take them without having to recompile Mercurial). 
> I'd like to get an idea if people think they would be worthwhile 
> turning into a series of changesets (I've only modified paper, atom 
> and rss as they're the only ones I use). I can't give any commitment 
> on timeframe right now ...
> 1. Bugfix: allow parsing branch/tag/bookmark names from the URL if the 
> name contains a forward slash.
> It is legal to have a branch/tag/bookmark with a forward slash in the 
> name, but currently a URL of the form:
> http://localhost:8000/shortlog/namespace/branch
> will throw a RepoLookupError on 'namespace', failing to determine that 
> there is a branch named 'namespace/branch'.
> The way I'd like to fix this is to progressively test each potential 
> name, starting with the longest, until I find one that is an actual 
> revision. In the above I would first test 'namespace/branch', then 
> 'namespace'. Anything left over after the revision is found is assumed 
> to be a file path. In practice it's unlikely to accidentally get a 
> revision that was unintended, but it is in theory possible. I can't 
> think of a better way to do it though - I'm open to suggestions.
> My monkey-patched version doesn't work that way - unfortunately 
> there's nowhere suitable to hook into hgweb_mod.run_wsgi so I've had 
> to do much more code duplication than I'd like.

Yes, that would make the problem more manageable but not solve the real 
problem: The URL scheme is ambiguous for changeset labelled with 
something containing '/'.

According to the standards it should be possible to use


(IIRC) - but a lot of existing software will probably normalize that.

One solution could be to let hgweb generate and accept an additional 
encoding, for instance using ':' as separator instead of '/'.

This issue is however not just a bug in the implementation; it is 
unfortunate design. I do thus not think it is material for a stable 
release, and it should wait until 2.6 has been released.

> 2. Using the revision specified in the URL for navigation links. For 
> example, if I requested http://localhost:8000/branch_name, the 
> navigation links would be:
> log: http://localhost:8000/shortlog/branch_name
> graph: http://localhost:8000/graph/branch_name
> The advantage here is that if a branch, tag or bookmark name is 
> specified, moving to another page will keep you at that 
> branch/tag/bookmark rather than the specific revision.
> The changeset link and the changeset entries in the log/graph still go 
> to the specific revisions.

That is https://bz.selenic.com/show_bug.cgi?id=2296


More information about the Mercurial-devel mailing list