changeset 964:3f37720e7dc7

hgweb: Make maxfiles, maxchanges, and allowpull proper config options
author mpm@selenic.com
date Fri, 19 Aug 2005 22:12:40 -0800
parents 84355e3e4493
children a425123e6afe
files doc/hgrc.5.txt mercurial/hgweb.py
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Fri Aug 19 22:11:48 2005 -0800
+++ b/doc/hgrc.5.txt	Fri Aug 19 22:12:40 2005 -0800
@@ -114,7 +114,7 @@
   ssh;;
     command to use for SSH connections. Default is 'ssh'.
   remotecmd;;
-    command to use for remote push operations. Default is 'hg'.
+    remote command to use for clone/push/pull operations. Default is 'hg'.
 
 
 web::
@@ -134,6 +134,12 @@
     Where to output the error log. Default is stderr.
   templates;;
     Where to find the HTML templates. Default is install path.
+  maxchanges;;
+    Maximum number of changes to list on the changelog. Default is 10.
+  maxfiles;;
+    Maximum number of files to list per changeset. Default is 10.
+  allowpull;;
+    Whether to allow pulling from the repository. Default is true.
 
 AUTHOR
 ------
--- a/mercurial/hgweb.py	Fri Aug 19 22:11:48 2005 -0800
+++ b/mercurial/hgweb.py	Fri Aug 19 22:12:40 2005 -0800
@@ -127,8 +127,6 @@
     }
 
 class hgweb:
-    maxchanges = 10
-    maxfiles = 10
 
     def __init__(self, path, name=None, templates=""):
         self.templates = templates
@@ -142,6 +140,9 @@
         if s.st_mtime != self.mtime:
             self.mtime = s.st_mtime
             self.repo = repository(ui(), self.path)
+            self.maxchanges = self.repo.ui.config("web", "maxchanges", 10)
+            self.maxfiles = self.repo.ui.config("web", "maxchanges", 10)
+            self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
 
     def date(self, cs):
         return time.asctime(time.gmtime(float(cs[2].split(' ')[0])))
@@ -688,7 +689,7 @@
         elif args['cmd'][0] == 'changegroup':
             httphdr("application/mercurial-0.1")
             nodes = []
-            if self.viewonly:
+            if not self.allowpull:
                 return
 
             if args.has_key('roots'):