Handle newer CVS date formats like "2001/08/26 22:16:22" which break date-to-time

This commit is contained in:
Steve Purcell 2012-10-20 20:22:14 +01:00
parent a69ee2af7e
commit 4b451f5dc7

View file

@ -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!"))
)))