Use path relative to document root as reponame if published via a web server.
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 31 Aug 2005 08:38:34 +0200
changeset 1172 3f30a5e7e15b
parent 1170 85555540a4e2
child 1173 bc9695f1f872
Use path relative to document root as reponame if published via a web server. The full path is still displayed when using 'hg serve'.
mercurial/hgweb.py
--- a/mercurial/hgweb.py	Wed Aug 31 07:25:02 2005 +0200
+++ b/mercurial/hgweb.py	Wed Aug 31 08:38:34 2005 +0200
@@ -178,8 +178,7 @@
             self.repo = repo
 
         self.mtime = -1
-        self.reponame = name or self.repo.ui.config("web", "name",
-                                                    self.repo.root)
+        self.reponame = name
         self.archives = 'zip', 'gz', 'bz2'
 
     def refresh(self):
@@ -730,6 +729,9 @@
         if "?" in uri:
             uri = uri.split("?")[0]
         url = "http://%s%s%s" % (req.env["SERVER_NAME"], port, uri)
+        if not self.reponame:
+            self.reponame = (self.repo.ui.config("web", "name")
+                             or uri.strip('/') or self.repo.root)
 
         self.t = templater(m, common_filters,
                            {"url": url,