comparison lisp/vc-hooks.el @ 13378:96ff45331eb4

(vc-utc-string): Use timezone of TIMEVAL for the correction, not the current one. (vc-rcsdiff-knows-brief): New variable. (vc-rcs-lock-from-diff): Use it.
author André Spiegel <spiegel@gnu.org>
date Thu, 02 Nov 1995 09:35:04 +0000
parents 1f9b08a989ea
children 1c20ebe08f0a
comparison
equal deleted inserted replaced
13377:885d4e7869ba 13378:96ff45331eb4
39 The value is only computed when needed to avoid an expensive search.") 39 The value is only computed when needed to avoid an expensive search.")
40 40
41 (defvar vc-handle-cvs t 41 (defvar vc-handle-cvs t
42 "*If non-nil, use VC for files managed with CVS. 42 "*If non-nil, use VC for files managed with CVS.
43 If it is nil, don't use VC for those files.") 43 If it is nil, don't use VC for those files.")
44
45 (defvar vc-rcsdiff-knows-brief nil
46 "*Indicates whether rcsdiff understands the --brief option.
47 The value is either `yes', `no', or nil. If it is nil, VC tries
48 to use --brief and sets this variable to remember whether it worked.")
44 49
45 (defvar vc-path 50 (defvar vc-path
46 (if (file-directory-p "/usr/sccs") 51 (if (file-directory-p "/usr/sccs")
47 '("/usr/sccs") 52 '("/usr/sccs")
48 nil) 53 nil)
561 (let ((uid (nth 2 (file-attributes file)))) 566 (let ((uid (nth 2 (file-attributes file))))
562 (if (= uid (user-uid)) (user-login-name) uid))) 567 (if (= uid (user-uid)) (user-login-name) uid)))
563 568
564 (defun vc-rcs-lock-from-diff (file) 569 (defun vc-rcs-lock-from-diff (file)
565 ;; Diff the file against the master version. If differences are found, 570 ;; Diff the file against the master version. If differences are found,
566 ;; mark the file locked. This is only meaningful for RCS with non-strict 571 ;; mark the file locked. This is only used for RCS with non-strict
567 ;; locking. 572 ;; locking. (If "rcsdiff" doesn't understand --brief, we do a double-take
568 (if (zerop (vc-simple-command 1 "rcsdiff" file 573 ;; and remember the fact for the future.)
569 "--brief" ; Some diffs don't understand "--brief", but 574 (let* ((version (concat "-r" (vc-workfile-version file)))
570 ; for non-strict locking under VC we require it. 575 (status (if (eq vc-rcsdiff-knows-brief 'no)
571 (concat "-r" (vc-workfile-version file)))) 576 (vc-simple-command 1 "rcsdiff" file version)
572 (vc-file-setprop file 'vc-locking-user 'none) 577 (vc-simple-command 2 "rcsdiff" file "--brief" version))))
573 (vc-file-setprop file 'vc-locking-user (vc-file-owner file)))) 578 (if (eq status 2)
579 (if (not vc-rcsdiff-knows-brief)
580 (setq vc-rcsdiff-knows-brief 'no
581 status (vc-simple-command 1 "rcsdiff" file version))
582 (error "rcsdiff failed."))
583 (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes)))
584 (if (zerop status)
585 (vc-file-setprop file 'vc-locking-user 'none)
586 (vc-file-setprop file 'vc-locking-user (vc-file-owner file)))))
574 587
575 (defun vc-locking-user (file) 588 (defun vc-locking-user (file)
576 ;; Return the name of the person currently holding a lock on FILE. 589 ;; Return the name of the person currently holding a lock on FILE.
577 ;; Return nil if there is no such person. (Sometimes, not the name 590 ;; Return nil if there is no such person. (Sometimes, not the name
578 ;; of the locking user but his uid will be returned.) 591 ;; of the locking user but his uid will be returned.)
735 vc-master-templates) 748 vc-master-templates)
736 nil))))) 749 nil)))))
737 750
738 (defun vc-utc-string (timeval) 751 (defun vc-utc-string (timeval)
739 ;; Convert a time value into universal time, and return it as a 752 ;; Convert a time value into universal time, and return it as a
740 ;; human-readable string. This is to compare CVS checkout times 753 ;; human-readable string. This is for comparing CVS checkout times
741 ;; with file modification times. 754 ;; with file modification times.
742 (let (utc (high (car timeval)) (low (nth 1 timeval)) 755 (let (utc (high (car timeval)) (low (nth 1 timeval))
743 (offset (car (current-time-zone)))) 756 (offset (car (current-time-zone timeval))))
744 (setq low (- low offset)) 757 (setq low (- low offset))
745 (setq utc (if (> low 65535) 758 (setq utc (if (> low 65535)
746 (list (1+ high) (- low 65536)) 759 (list (1+ high) (- low 65536))
747 (if (< low 0) 760 (if (< low 0)
748 (list (1- high) (+ 65536 low)) 761 (list (1- high) (+ 65536 low))