[PATCH 3 of 8] Create repository objects instead of using own
ConfigParser in hgwebdir
Matt Mackall
mpm at selenic.com
Sun Aug 28 15:33:48 CDT 2005
On Sun, Aug 28, 2005 at 06:54:53PM +0200, Thomas Arendsen Hein wrote:
> # HG changeset patch
> # User Thomas Arendsen Hein <thomas at intevation.de>
> # Node ID a67982e64109087eb728b5cb7a45a37c5785639b
> # Parent 1ad52c7679e14abd40f6f3e319f707df63bc6daa
> Create repository objects instead of using own ConfigParser in hgwebdir.
This has some performance implications, which is why I didn't do it
the first time around. Opening a repo requires parsing the changelog
and manifest indices. It takes a non-negligible amount of time to do
this (looks to be about .007s on my box) so opening a dozen repos
every time someone hits the index page is not very desirable.
> diff -r 1ad52c7679e1 -r a67982e64109 mercurial/hgweb.py
> --- a/mercurial/hgweb.py Sun Aug 28 15:53:37 2005
> +++ b/mercurial/hgweb.py Sun Aug 28 15:55:15 2005
> @@ -942,14 +942,8 @@
> repos = self.cp.items("paths")
> repos.sort()
> for name, path in repos:
> - cp2 = ConfigParser.SafeConfigParser()
> - cp2.read(os.path.join(path, ".hg", "hgrc"))
> -
> - def get(sec, val, default):
> - try:
> - return cp2.get(sec, val)
> - except:
> - return default
> + repo = repository(ui(), path)
> + get = repo.ui.config
>
> url = os.environ["REQUEST_URI"] + "/" + name
> url = url.replace("//", "/")
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list