hg serve error when using the "raw" template

Matt Mackall mpm at selenic.com
Fri Jul 27 11:56:53 CDT 2012


On Wed, 2012-07-25 at 23:12 +0200, Angel Ezquerra wrote:
> Hi,
> 
> I've been playing around with the hgweb templates, working on a way to
> add a link to the parent directory (to make it easier to navigate the
> tree of repositories). This is something that I plan to submit to the
> list after the freeze. However, while doing so I tried the "raw"
> template and I noticed that if you try to access a repository while
> using the raw template you get an error:
> 
> 192.168.1.37 - - [25/Jul/2012 23:07:12] "GET /test/hg/hg/ HTTP/1.1" 500 -
> 192.168.1.37 - - [25/Jul/2012 23:07:12] Exception happened during processing req
> uest '/test/hg/hg/':
> Traceback (most recent call last):
>   File "C:\Users\Angel\Documents\Repositories\hg-2.1\mercurial\hgweb\server.py",
>  line 77, in do_POST
>     self.do_write()
>   File "C:\Users\Angel\Documents\Repositories\hg-2.1\mercurial\hgweb\server.py",
>  line 70, in do_write
>     self.do_hgweb()
>   File "C:\Users\Angel\Documents\Repositories\hg-2.1\mercurial\hgweb\server.py",
>  line 137, in do_hgweb
>     for chunk in self.server.application(env, self._start_response):
>   File "C:\Users\Angel\Documents\Repositories\hg-2.1\mercurial\hgweb\hgwebdir_mo
> d.py", line 147, in __call__
>     return self.run_wsgi(req)
>   File "C:\Users\Angel\Documents\Repositories\hg-2.1\mercurial\hgweb\hgwebdir_mo
> d.py", line 205, in run_wsgi
>     return hgweb(repo).run_wsgi(req)
>   File "C:\Users\Angel\Documents\Repositories\hg-2.1\mercurial\hgweb\hgweb_mod.p
> y", line 189, in run_wsgi
>     req.form['cmd'] = [tmpl.cache['default']]
> KeyError: 'default'
> 
> This happens on the tip of stable but also on 2.2. I don't really know
> what the purpose of the raw template is so I don't know if this is
> normal. I'd like to confirm whether this is expected or it is a real
> error.

The raw template exists to provide the various raw links that are
present in other styles. It is not meant to be a useful style on its
own. Similarly for the rss and atom styles: it's not intended that you
can "browse" a repository via rss data.

The above error is triggered because the raw style has no "default" view
(in paper, the default view is the shortlog). We could set a default
view to a page that said "not a valid hgweb default style".

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list