[PATCH 3 of 6] Use ConfigParser only in hgwebdir.__init__()

Thomas Arendsen Hein thomas at intevation.de
Mon Aug 29 00:43:59 CDT 2005


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 033c968d7c667b2bc107ed95a5d902731516355f
# Parent  04d52b446e5e6da50886f2e6dcb68739b4ec419c
Use ConfigParser only in hgwebdir.__init__()

diff -r 04d52b446e5e -r 033c968d7c66 mercurial/hgweb.py
--- a/mercurial/hgweb.py	Mon Aug 29 05:19:02 2005
+++ b/mercurial/hgweb.py	Mon Aug 29 05:28:39 2005
@@ -922,8 +922,10 @@
 # This is a stopgap
 class hgwebdir:
     def __init__(self, config):
-        self.cp = ConfigParser.SafeConfigParser()
-        self.cp.read(config)
+        cp = ConfigParser.SafeConfigParser()
+        cp.read(config)
+        self.repos = cp.items("paths")
+        self.repos.sort()
 
     def run(self):
         def header(**map):
@@ -939,9 +941,7 @@
 
         def entries(**map):
             parity = 0
-            repos = self.cp.items("paths")
-            repos.sort()
-            for name, path in repos:
+            for name, path in self.repos:
                 u = ui()
                 u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
                 get = u.config
@@ -968,8 +968,8 @@
         virtual = virtual.strip('/')
 
         if len(virtual):
-            if self.cp.has_option("paths", virtual):
-                real = self.cp.get("paths", virtual)
+            real = dict(self.repos).get(virtual)
+            if real:
                 h = hgweb(real)
                 h.run()
                 return


More information about the Mercurial mailing list