##// END OF EJS Templates
Make hgweb work when the repository is empty (no 00changelog.i)
Benoit Boissinot -
r1418:68f81ba0 default
parent child Browse files
Show More
@@ -63,6 +63,14 b' def up(p):'
63 return "/"
63 return "/"
64 return up + "/"
64 return up + "/"
65
65
66 def get_mtime(repo_path):
67 hg_path = os.path.join(repo_path, ".hg")
68 cl_path = os.path.join(hg_path, "00changelog.i")
69 if os.path.exists(os.path.join(cl_path)):
70 return os.stat(cl_path).st_mtime
71 else:
72 return os.stat(hg_path).st_mtime
73
66 class hgrequest:
74 class hgrequest:
67 def __init__(self, inp=None, out=None, env=None):
75 def __init__(self, inp=None, out=None, env=None):
68 self.inp = inp or sys.stdin
76 self.inp = inp or sys.stdin
@@ -178,9 +186,9 b' class hgweb:'
178 self.archives = 'zip', 'gz', 'bz2'
186 self.archives = 'zip', 'gz', 'bz2'
179
187
180 def refresh(self):
188 def refresh(self):
181 s = os.stat(os.path.join(self.repo.root, ".hg", "00changelog.i"))
189 mtime = get_mtime(self.repo.root)
182 if s.st_mtime != self.mtime:
190 if mtime != self.mtime:
183 self.mtime = s.st_mtime
191 self.mtime = mtime
184 self.repo = hg.repository(self.repo.ui, self.repo.root)
192 self.repo = hg.repository(self.repo.ui, self.repo.root)
185 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10))
193 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10))
186 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10))
194 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10))
@@ -989,9 +997,7 b' class hgwebdir:'
989 .replace("//", "/"))
997 .replace("//", "/"))
990
998
991 # update time with local timezone
999 # update time with local timezone
992 d = (os.stat(os.path.join(path,
1000 d = (get_mtime(path), util.makedate()[1])
993 ".hg", "00changelog.d")).st_mtime,
994 util.makedate()[1])
995
1001
996 yield dict(contact=(get("ui", "username") or # preferred
1002 yield dict(contact=(get("ui", "username") or # preferred
997 get("web", "contact") or # deprecated
1003 get("web", "contact") or # deprecated
General Comments 0
You need to be logged in to leave comments. Login now