From 4b451f5dc724e7b795046a0ebcab955e47552ba4 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Sat, 20 Oct 2012 20:22:14 +0100 Subject: [PATCH] Handle newer CVS date formats like "2001/08/26 22:16:22" which break date-to-time --- package-build.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package-build.el b/package-build.el index 87896073..c0dc9cf7 100644 --- a/package-build.el +++ b/package-build.el @@ -82,7 +82,13 @@ "Parse STR as a time, and format as a YYYYMMDD.HHMM string." ;; We remove zero-padding the HH portion, as it is lost ;; when stored in the archive-contents - (let ((time (date-to-time (substring-no-properties str)))) + (let* ((s (substring-no-properties str)) + (time (condition-case nil + (date-to-time s) + ('error + ;; Handle newer CVS formats like "2001/08/26 22:16:22" + ;; which break date-to-time + (date-to-time (replace-regexp-in-string "/" "-" s)))))) (concat (format-time-string "%Y%m%d." time) (format "%d" (or (parse-integer (format-time-string "%H%M" time)) 0))))) @@ -286,6 +292,7 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository." (apply 'pb/run-process dir "cvs" "log" (pb/expand-source-file-list dir config)) (or (pb/find-parse-time-latest "date: \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\} \\+[0-9]\\{2\\}[0-9]\\{2\\}\\)") + (pb/find-parse-time-latest "date: \\([0-9]\\{4\\}/[0-9]\\{2\\}/[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\);") (error "No valid timestamps found!")) )))