You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/11/26 03:27:50 UTC

[whimsy] branch master updated: handle the case where the agenda contents didn't change but the date did

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new c4b8e0b  handle the case where the agenda contents didn't change but the date did
c4b8e0b is described below

commit c4b8e0bd21669d58f27b0b1c34a9c896b629903c
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Nov 25 22:26:46 2017 -0500

    handle the case where the agenda contents didn't change but the date did
    
    Commonly occurs when the file is changed via the agenda tool, committed to
    svn, and then the svn working directory is updated.
---
 www/board/agenda/models/agenda.rb | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/www/board/agenda/models/agenda.rb b/www/board/agenda/models/agenda.rb
index 6c15aab..ebe3ad2 100755
--- a/www/board/agenda/models/agenda.rb
+++ b/www/board/agenda/models/agenda.rb
@@ -65,7 +65,6 @@ class Agenda
   def self.update_cache(file, path, contents, quick)
     update = {
       mtime: (quick ? -1 : File.mtime(path)),
-      parsed: ASF::Board::Agenda.parse(contents, quick),
       digest: Digest::SHA256.base64digest(contents)
     }
 
@@ -73,8 +72,16 @@ class Agenda
     # or the previous entry was the result of a 'quick' parse.
     current = Agenda[file]
     if not current or current[:digest] != update[:digest] or
-      current[:mtime].to_i <= 0
+      current[:mtime].to_i < update[:mtime].to_i
     then
+      if current and current[:digest] == update[:digest] and
+        current[:mtime].to_i > 0
+      then
+        update[:parsed] = current[:parsed]
+      else
+        update[:parsed] = ASF::Board::Agenda.parse(contents, quick)
+      end
+
       Agenda[file] = update
     end
   end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].