comparison lisp/vc.el @ 17135:1814adcc2648

(vc-backend-diff): Handle RCS and SCCS separately.
author André Spiegel <spiegel@gnu.org>
date Tue, 04 Mar 1997 18:00:30 +0000
parents 436e2bd4efcc
children ac40292bd898
comparison
equal deleted inserted replaced
17134:124013c4d7b2 17135:1814adcc2648
2231 ) 2231 )
2232 2232
2233 (defun vc-backend-diff (file &optional oldvers newvers cmp) 2233 (defun vc-backend-diff (file &optional oldvers newvers cmp)
2234 ;; Get a difference report between two versions of FILE. 2234 ;; Get a difference report between two versions of FILE.
2235 ;; Get only a brief comparison report if CMP, a difference report otherwise. 2235 ;; Get only a brief comparison report if CMP, a difference report otherwise.
2236 (let ((backend (vc-backend file))) 2236 (let ((backend (vc-backend file)) options status
2237 (diff-switches-list (if (listp diff-switches)
2238 diff-switches
2239 (list diff-switches))))
2237 (cond 2240 (cond
2238 ((eq backend 'SCCS) 2241 ((eq backend 'SCCS)
2239 (setq oldvers (vc-lookup-triple file oldvers)) 2242 (setq oldvers (vc-lookup-triple file oldvers))
2240 (setq newvers (vc-lookup-triple file newvers))) 2243 (setq newvers (vc-lookup-triple file newvers))
2244 (setq options (append (list (and cmp "--brief") "-q"
2245 (and oldvers (concat "-r" oldvers))
2246 (and newvers (concat "-r" newvers)))
2247 (and (not cmp) diff-switches-list)))
2248 (apply 'vc-do-command "*vc-diff*" 1 "vcdiff" file 'MASTER options))
2241 ((eq backend 'RCS) 2249 ((eq backend 'RCS)
2242 (if (not oldvers) (setq oldvers (vc-workfile-version file))) 2250 (if (not oldvers) (setq oldvers (vc-workfile-version file)))
2243 ;; If we know that --brief is not supported, don't try it. 2251 ;; If we know that --brief is not supported, don't try it.
2244 (setq cmp (and cmp (not (eq vc-rcsdiff-knows-brief 'no)))))) 2252 (setq cmp (and cmp (not (eq vc-rcsdiff-knows-brief 'no))))
2245 ;; SCCS and RCS shares a lot of code. 2253 (setq options (append (list (and cmp "--brief") "-q"
2246 (cond 2254 (concat "-r" oldvers)
2247 ((or (eq backend 'SCCS) (eq backend 'RCS)) 2255 (and newvers (concat "-r" newvers)))
2248 (let* ((command (if (eq backend 'SCCS) "vcdiff" "rcsdiff")) 2256 (and (not cmp) diff-switches-list)))
2249 (mode (if (eq backend 'RCS) 'WORKFILE 'MASTER)) 2257 (setq status (apply 'vc-do-command "*vc-diff*" 2
2250 (options (append (list (and cmp "--brief") 2258 "rcsdiff" file 'WORKFILE options))
2251 "-q" 2259 ;; If --brief didn't work, do a double-take and remember it
2252 (and oldvers (concat "-r" oldvers)) 2260 ;; for the future.
2253 (and newvers (concat "-r" newvers))) 2261 (if (eq status 2)
2254 (and (not cmp) 2262 (prog1
2255 (if (listp diff-switches) 2263 (apply 'vc-do-command "*vc-diff*" 1 "rcsdiff" file 'WORKFILE
2256 diff-switches 2264 (if cmp (cdr options) options))
2257 (list diff-switches))))) 2265 (if cmp (setq vc-rcsdiff-knows-brief 'no)))
2258 (status (apply 'vc-do-command "*vc-diff*" 2 2266 ;; If --brief DID work, remember that, too.
2259 command file mode options))) 2267 (and cmp (not vc-rcsdiff-knows-brief)
2260 ;; If --brief didn't work, do a double-take and remember it 2268 (setq vc-rcsdiff-knows-brief 'yes))
2261 ;; for the future. 2269 status))
2262 (if (eq status 2)
2263 (prog1
2264 (apply 'vc-do-command "*vc-diff*" 1 command file 'WORKFILE
2265 (if cmp (cdr options) options))
2266 (if cmp (setq vc-rcsdiff-knows-brief 'no)))
2267 ;; If --brief DID work, remember that, too.
2268 (and cmp (not vc-rcsdiff-knows-brief)
2269 (setq vc-rcsdiff-knows-brief 'yes))
2270 status)))
2271 ;; CVS is different. 2270 ;; CVS is different.
2272 ((eq backend 'CVS) 2271 ((eq backend 'CVS)
2273 (if (string= (vc-workfile-version file) "0") ;CVS 2272 (if (string= (vc-workfile-version file) "0")
2274 ;; This file is added but not yet committed; there is no master file. 2273 ;; This file is added but not yet committed; there is no master file.
2275 (if (or oldvers newvers) 2274 (if (or oldvers newvers)
2276 (error "No revisions of %s exist" file) 2275 (error "No revisions of %s exist" file)
2277 (if cmp 1 ;; file is added but not committed, 2276 (if cmp 1 ;; file is added but not committed,
2278 ;; we regard this as "changed". 2277 ;; we regard this as "changed".