553 |
(vc-do-command buffer 0 "cvs" file "annotate" (if version |
(vc-do-command buffer 0 "cvs" file "annotate" (if version |
554 |
(concat "-r" version)))) |
(concat "-r" version)))) |
555 |
|
|
556 |
(defun vc-cvs-annotate-difference (point) |
(defun vc-cvs-annotate-current-time () |
557 |
"Return the difference between the time of the line and the current time. |
"Return the current time, based at midnight of the current day, and |
558 |
Return values are as defined for `current-time'." |
encoded as fractional days." |
559 |
;; We need a list of months and their corresponding numbers. |
(vc-annotate-convert-time |
560 |
(if (looking-at "^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ") |
(apply 'encode-time 0 0 0 (nthcdr 3 (decode-time (current-time)))))) |
561 |
|
|
562 |
|
(defun vc-cvs-annotate-time () |
563 |
|
"Return the time of the next annotation (as fraction of days) |
564 |
|
systime , or NIL if there is none." |
565 |
|
(let ((time-stamp |
566 |
|
"^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): ")) |
567 |
|
(if (looking-at time-stamp) |
568 |
(progn |
(progn |
569 |
(let* ((day (string-to-number (match-string 1))) |
(let* ((day (string-to-number (match-string 1))) |
570 |
(month (cdr (assoc (match-string 2) vc-cvs-local-month-numbers))) |
(month (cdr (assoc (match-string 2) |
571 |
|
vc-cvs-local-month-numbers))) |
572 |
(year-tmp (string-to-number (match-string 3))) |
(year-tmp (string-to-number (match-string 3))) |
573 |
;; Years 0..68 are 2000..2068. |
;; Years 0..68 are 2000..2068. |
574 |
;; Years 69..99 are 1969..1999. |
;; Years 69..99 are 1969..1999. |
577 |
(t 0)) |
(t 0)) |
578 |
year-tmp))) |
year-tmp))) |
579 |
(goto-char (match-end 0)) ; Position at end makes for nicer overlay result |
(goto-char (match-end 0)) ; Position at end makes for nicer overlay result |
580 |
(- (car (current-time)) |
(vc-annotate-convert-time (encode-time 0 0 0 day month year)))) |
|
(car (encode-time 0 0 0 day month year))))) |
|
581 |
;; If we did not look directly at an annotation, there might be |
;; If we did not look directly at an annotation, there might be |
582 |
;; some further down. This is the case if we are positioned at |
;; some further down. This is the case if we are positioned at |
583 |
;; the very top of the buffer, for instance. |
;; the very top of the buffer, for instance. |
584 |
(if (re-search-forward |
(if (re-search-forward time-stamp nil t) |
|
"^\\S-+\\s-+\\S-+\\s-+\\([0-9]+\\)-\\(\\sw+\\)-\\([0-9]+\\)): " nil t) |
|
585 |
(progn |
(progn |
586 |
(beginning-of-line nil) |
(beginning-of-line nil) |
587 |
(vc-cvs-annotate-difference (point)))))) |
(vc-cvs-annotate-time)))))) |
|
|
|
588 |
|
|
589 |
;;; |
;;; |
590 |
;;; Snapshot system |
;;; Snapshot system |