mercurial/hgweb.py
changeset 964 3f37720e7dc7
parent 957 305ab68c4394
child 981 4f81068ed8cd
equal deleted inserted replaced
963:84355e3e4493 964:3f37720e7dc7
   125     "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--"),
   125     "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--"),
   126     "rfc822date": rfc822date,
   126     "rfc822date": rfc822date,
   127     }
   127     }
   128 
   128 
   129 class hgweb:
   129 class hgweb:
   130     maxchanges = 10
       
   131     maxfiles = 10
       
   132 
   130 
   133     def __init__(self, path, name=None, templates=""):
   131     def __init__(self, path, name=None, templates=""):
   134         self.templates = templates
   132         self.templates = templates
   135         self.reponame = name
   133         self.reponame = name
   136         self.path = path
   134         self.path = path
   140     def refresh(self):
   138     def refresh(self):
   141         s = os.stat(os.path.join(self.path, ".hg", "00changelog.i"))
   139         s = os.stat(os.path.join(self.path, ".hg", "00changelog.i"))
   142         if s.st_mtime != self.mtime:
   140         if s.st_mtime != self.mtime:
   143             self.mtime = s.st_mtime
   141             self.mtime = s.st_mtime
   144             self.repo = repository(ui(), self.path)
   142             self.repo = repository(ui(), self.path)
       
   143             self.maxchanges = self.repo.ui.config("web", "maxchanges", 10)
       
   144             self.maxfiles = self.repo.ui.config("web", "maxchanges", 10)
       
   145             self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
   145 
   146 
   146     def date(self, cs):
   147     def date(self, cs):
   147         return time.asctime(time.gmtime(float(cs[2].split(' ')[0])))
   148         return time.asctime(time.gmtime(float(cs[2].split(' ')[0])))
   148 
   149 
   149     def listfiles(self, files, mf):
   150     def listfiles(self, files, mf):
   686                 sys.stdout.write(" ".join(map(hex, b)) + "\n")
   687                 sys.stdout.write(" ".join(map(hex, b)) + "\n")
   687 
   688 
   688         elif args['cmd'][0] == 'changegroup':
   689         elif args['cmd'][0] == 'changegroup':
   689             httphdr("application/mercurial-0.1")
   690             httphdr("application/mercurial-0.1")
   690             nodes = []
   691             nodes = []
   691             if self.viewonly:
   692             if not self.allowpull:
   692                 return
   693                 return
   693 
   694 
   694             if args.has_key('roots'):
   695             if args.has_key('roots'):
   695                 nodes = map(bin, args['roots'][0].split(" "))
   696                 nodes = map(bin, args['roots'][0].split(" "))
   696 
   697