[PATCH] hgweb: accept /path/to/file as a shortcut to /file/somehead/path/to/file

Matt Mackall mpm at selenic.com
Sat Apr 30 07:18:49 CDT 2011


On Sat, 2011-04-30 at 14:08 +0200, Alexander Solovyov wrote:
> On Sat, Apr 30, 2011 at 13:57, Matt Mackall <mpm at selenic.com> wrote:
> >> hgweb: accept /path/to/file as a shortcut to /file/somehead/path/to/file
> >>
> >> If you open http://host/filename (which is not a valid command from
> >> hgweb.webcommands), now hgweb will go through heads and seek for a 'filename' in
> >> them.
> >
> > This strikes me as too magical.
> 
> Eh, it is a bit, but it's so much nicer to be able to write some url
> to file by hand - I'm always stuck for a few seconds remembering the
> exact syntax (/file/cset/path), and it's quite common operation I
> think to give a link to a file to someone.
> 
> I did it a bit wrong in this patch, it should be a redirect to an url
> instead of just returning file view - I can rework it and resend if
> this can be accepted. Also, it's a fallback, so it doesn't make
> anything harmful...

Well there are two magical things here (read two different pitfalls for
users):

- what happens if someone tries to use this and their file path collides
with hgweb's URL space?

- it chooses an effectively arbitrary head to display a file name, so
it's highly dependent on commit order between branches

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list