summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@twinsun.com>1996-01-20 20:42:06 +0000
committerPaul Eggert <eggert@twinsun.com>1996-01-20 20:42:06 +0000
commita934a390fe0cb752c18a6032a413260f53930c7c (patch)
treecc59fb2dbb48ce8553cdf18ba859f7b372f62b66
parentd0842f7a5bcb6a54eef71bb744f719d416e14723 (diff)
downloademacs-a934a390fe0cb752c18a6032a413260f53930c7c.tar.gz
(vc-utc-string): Remove; it wasn't reliable near DST or leap-second
transitions. (vc-find-cvs-master): Convert UTC string to encoded time and compare the results to the file attributes, rather than attempting to convert file attributes to UTC string (which wasn't reliable).
-rw-r--r--lisp/vc-hooks.el32
1 files changed, 15 insertions, 17 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 9fbe79508a7..27b57e17de1 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -764,20 +764,6 @@ For CVS, the full name of CVS/Entries is returned."
vc-master-templates)
nil)))))
-(defun vc-utc-string (timeval)
- ;; Convert a time value into universal time, and return it as a
- ;; human-readable string. This is for comparing CVS checkout times
- ;; with file modification times.
- (let (utc (high (car timeval)) (low (nth 1 timeval))
- (offset (car (current-time-zone timeval))))
- (setq low (- low offset))
- (setq utc (if (> low 65535)
- (list (1+ high) (- low 65536))
- (if (< low 0)
- (list (1- high) (+ 65536 low))
- (list high low))))
- (current-time-string utc)))
-
(defun vc-find-cvs-master (dirname basename)
;; Check if DIRNAME/BASENAME is handled by CVS.
;; If it is, do a (throw 'found (cons MASTER 'CVS)).
@@ -801,7 +787,7 @@ For CVS, the full name of CVS/Entries is returned."
(cond
((re-search-forward
(concat "^/" (regexp-quote basename)
- "/\\([^/]*\\)/\\([^/]*\\)/")
+ "/\\([^/]*\\)/[^ /]* \\([A-Z][a-z][a-z]\\) *\\([0-9]*\\) \\([0-9]*\\):\\([0-9]*\\):\\([0-9]*\\) \\([0-9]*\\)/")
nil t)
(setq case-fold-search fold) ;; restore the old value
;; We found it. Store away version number now that we
@@ -811,8 +797,20 @@ For CVS, the full name of CVS/Entries is returned."
(match-string 1))
;; If the file hasn't been modified since checkout,
;; store the checkout-time.
- (let ((mtime (nth 5 (file-attributes file))))
- (if (string= (match-string 2) (vc-utc-string mtime))
+ (let ((mtime (nth 5 (file-attributes file)))
+ (second (string-to-number (match-string 6)))
+ (minute (string-to-number (match-string 5)))
+ (hour (string-to-number (match-string 4)))
+ (day (string-to-number (match-string 3)))
+ (year (string-to-number (match-string 7))))
+ (if (equal mtime
+ (encode-time
+ second minute hour day
+ (/ (string-match
+ (match-string 2)
+ "xxxJanFebMarAprMayJunJulAugSepOctNovDec")
+ 3)
+ year 0))
(vc-file-setprop file 'vc-checkout-time mtime)
(vc-file-setprop file 'vc-checkout-time 0)))
(throw 'found (cons (concat dirname "CVS/Entries") 'CVS)))