[PATCH stable] hgweb: handle exception of misconfigured path on index page

Yuya Nishihara yuya at tcha.org
Mon Aug 23 11:29:44 CDT 2010


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1282580862 -32400
# Node ID d76eb7dd56cdb816cf38b10b05a4c76a0fbb5936
# Parent  2315a95ee88759ad2ed250dcbf2fc93be4073688
hgweb: handle exception of misconfigured path on index page

If hgweb.config contains wrong path mapping, hgweb causes internal server
error on repository index page.

This patch changes makeindex() to ignore RepoError, because it looks to be
designed to suppress configuration error.

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -234,7 +234,8 @@ class hgwebdir(object):
                 try:
                     r = hg.repository(self.ui, path)
                     d = (get_mtime(r.spath), util.makedate()[1])
-                except OSError:
+                except (OSError, error.RepoError):
+                    u.warn(_('error getting repository mtime %s\n') % path)
                     continue
 
                 contact = get_contact(get)


More information about the Mercurial-devel mailing list