##// END OF EJS Templates
hgweb: use an extensible list of files to check for refresh...
Pierre-Yves David -
r25718:2e32f089 default
parent child Browse files
Show More
@@ -26,6 +26,13 b' perms = {'
26 'pushkey': 'push',
26 'pushkey': 'push',
27 }
27 }
28
28
29 ## Files of interest
30 # Used to check if the repository has changed looking at mtime and size of
31 # theses files. This should probably be relocated a bit higher in core.
32 foi = [('spath', '00changelog.i'),
33 ('spath', 'phaseroots'), # ! phase can change content at the same size
34 ]
35
29 def makebreadcrumb(url, prefix=''):
36 def makebreadcrumb(url, prefix=''):
30 '''Return a 'URL breadcrumb' list
37 '''Return a 'URL breadcrumb' list
31
38
@@ -120,10 +127,13 b' class hgweb(object):'
120 return repo.filtered('served')
127 return repo.filtered('served')
121
128
122 def refresh(self, request=None):
129 def refresh(self, request=None):
123 st = get_stat(self.repo.spath, '00changelog.i')
130 repostate = []
124 pst = get_stat(self.repo.spath, 'phaseroots')
131 # file of interrests mtime and size
125 # changelog mtime and size, phaseroots mtime and size
132 for meth, fname in foi:
126 repostate = ((st.st_mtime, st.st_size), (pst.st_mtime, pst.st_size))
133 prefix = getattr(self.repo, meth)
134 st = get_stat(prefix, fname)
135 repostate.append((st.st_mtime, st.st_size))
136 repostate = tuple(repostate)
127 # we need to compare file size in addition to mtime to catch
137 # we need to compare file size in addition to mtime to catch
128 # changes made less than a second ago
138 # changes made less than a second ago
129 if repostate != self.repostate:
139 if repostate != self.repostate:
General Comments 0
You need to be logged in to leave comments. Login now