diff mercurial/hgweb/common.py @ 13958:71f51cc71652 stable

hgweb: detect change based on changelog size too Before, there was a race between an access and a modification made within the same second.
author Martin Geisler <mg@lazybytes.net>
date Tue, 19 Apr 2011 15:15:56 +0200
parents 75f5f312df5f
children 141f88ae5276
line wrap: on
line diff
--- a/mercurial/hgweb/common.py	Tue Apr 19 13:25:19 2011 +0200
+++ b/mercurial/hgweb/common.py	Tue Apr 19 15:15:56 2011 +0200
@@ -86,12 +86,16 @@
 def statusmessage(code, message=None):
     return '%d %s' % (code, message or _statusmessage(code))
 
-def get_mtime(spath):
+def get_stat(spath):
+    """stat changelog if it exists, spath otherwise"""
     cl_path = os.path.join(spath, "00changelog.i")
     if os.path.exists(cl_path):
-        return os.stat(cl_path).st_mtime
+        return os.stat(cl_path)
     else:
-        return os.stat(spath).st_mtime
+        return os.stat(spath)
+
+def get_mtime(spath):
+    return get_stat(spath).st_mtime
 
 def staticfile(directory, fname, req):
     """return a file inside directory with guessed Content-Type header