[PATCH 1 of 4 V2] hgweb: drop the default argument for get_stat

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jul 3 18:29:04 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1435943271 25200
#      Fri Jul 03 10:07:51 2015 -0700
# Node ID 668074775c8340236993cea30795204034d66d5c
# Parent  84518051bc3b851f736872df045d662de548b3c9
hgweb: drop the default argument for get_stat

This default argument is used twice and is making things confusing. Making it
explicit helps to clarify coming changesets

diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -110,20 +110,20 @@ def _statusmessage(code):
     return responses.get(code, ('Error', 'Unknown error'))[0]
 
 def statusmessage(code, message=None):
     return '%d %s' % (code, message or _statusmessage(code))
 
-def get_stat(spath, fn="00changelog.i"):
-    """stat fn (00changelog.i by default) if it exists, spath otherwise"""
+def get_stat(spath, fn):
+    """stat fn if it exists, spath otherwise"""
     cl_path = os.path.join(spath, fn)
     if os.path.exists(cl_path):
         return os.stat(cl_path)
     else:
         return os.stat(spath)
 
 def get_mtime(spath):
-    return get_stat(spath).st_mtime
+    return get_stat(spath, "00changelog.i").st_mtime
 
 def staticfile(directory, fname, req):
     """return a file inside directory with guessed Content-Type header
 
     fname always uses '/' as directory separator and isn't allowed to
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -118,11 +118,11 @@ class hgweb(object):
             return repo.filtered(viewconfig)
         else:
             return repo.filtered('served')
 
     def refresh(self, request=None):
-        st = get_stat(self.repo.spath)
+        st = get_stat(self.repo.spath, '00changelog.i')
         pst = get_stat(self.repo.spath, 'phaseroots')
         # changelog mtime and size, phaseroots mtime and size
         repostate = ((st.st_mtime, st.st_size), (pst.st_mtime, pst.st_size))
         # we need to compare file size in addition to mtime to catch
         # changes made less than a second ago


More information about the Mercurial-devel mailing list