From 318880476ed9a7af897cfc3c0d26becc7a855756 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Spiegel?= Date: Thu, 2 Nov 1995 09:35:04 +0000 Subject: [PATCH] (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. --- lisp/vc-hooks.el | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index a17e2617840..4b7bcbcf7af 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el @@ -42,6 +42,11 @@ The value is only computed when needed to avoid an expensive search.") "*If non-nil, use VC for files managed with CVS. If it is nil, don't use VC for those files.") +(defvar vc-rcsdiff-knows-brief nil + "*Indicates whether rcsdiff understands the --brief option. +The value is either `yes', `no', or nil. If it is nil, VC tries +to use --brief and sets this variable to remember whether it worked.") + (defvar vc-path (if (file-directory-p "/usr/sccs") '("/usr/sccs") @@ -563,14 +568,22 @@ For CVS, the full name of CVS/Entries is returned." (defun vc-rcs-lock-from-diff (file) ;; Diff the file against the master version. If differences are found, - ;; mark the file locked. This is only meaningful for RCS with non-strict - ;; locking. - (if (zerop (vc-simple-command 1 "rcsdiff" file - "--brief" ; Some diffs don't understand "--brief", but - ; for non-strict locking under VC we require it. - (concat "-r" (vc-workfile-version file)))) - (vc-file-setprop file 'vc-locking-user 'none) - (vc-file-setprop file 'vc-locking-user (vc-file-owner file)))) + ;; mark the file locked. This is only used for RCS with non-strict + ;; locking. (If "rcsdiff" doesn't understand --brief, we do a double-take + ;; and remember the fact for the future.) + (let* ((version (concat "-r" (vc-workfile-version file))) + (status (if (eq vc-rcsdiff-knows-brief 'no) + (vc-simple-command 1 "rcsdiff" file version) + (vc-simple-command 2 "rcsdiff" file "--brief" version)))) + (if (eq status 2) + (if (not vc-rcsdiff-knows-brief) + (setq vc-rcsdiff-knows-brief 'no + status (vc-simple-command 1 "rcsdiff" file version)) + (error "rcsdiff failed.")) + (if (not vc-rcsdiff-knows-brief) (setq vc-rcsdiff-knows-brief 'yes))) + (if (zerop status) + (vc-file-setprop file 'vc-locking-user 'none) + (vc-file-setprop file 'vc-locking-user (vc-file-owner file))))) (defun vc-locking-user (file) ;; Return the name of the person currently holding a lock on FILE. @@ -737,10 +750,10 @@ For CVS, the full name of CVS/Entries is returned." (defun vc-utc-string (timeval) ;; Convert a time value into universal time, and return it as a - ;; human-readable string. This is to compare CVS checkout times + ;; 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)))) + (offset (car (current-time-zone timeval)))) (setq low (- low offset)) (setq utc (if (> low 65535) (list (1+ high) (- low 65536)) -- 2.39.2