[SCM] patch-parser packaging branch, master, updated. 43474b21f016a6c6ceaa1bd528e34a0ab6b65fbb

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue Apr 14 07:56:01 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/patch-parser.git;a=commitdiff;h=dcf11bd

The following commit has been merged in the master branch:
commit dcf11bd77217622de4dbcc8caf274067ec56d948
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Apr 13 16:33:55 2015 +0200

    split date parsing into helper method
---
 lib/patch.rb | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/patch.rb b/lib/patch.rb
index c45367c..3956987 100644
--- a/lib/patch.rb
+++ b/lib/patch.rb
@@ -44,7 +44,14 @@ class Patch
     return unless d.valid?
     @dep3 = true
     @author = d.fetch('Author', 'Unknown')
-    @last_update = d.fetch('Last-Update', 'Unknown')
-    @last_update = Date.parse(@last_update).to_s if @last_update != 'Unknown'
+    @last_update = parse_date(d.fetch('Last-Update', nil))
+  end
+
+  def parse_date(date_string)
+    # Try to parse the date and conver to string. This allows us to conveniently
+    # parse full-time git dates into date-only values as commonly used in dep3.
+    Date.parse(date_string).to_s if date_string
+    rescue ArgumentError
+      warn "Failed to parse date: #{@last_update}."
   end
 end

-- 
patch-parser packaging



More information about the pkg-kde-commits mailing list