comparison lisp/ediff-vers.el @ 49428:0f80cb4f9d29

2003-01-25 Michael Kifer <kifer@cs.stonybrook.edu> * ediff.el (ediff-revision): better defaults. * ediff-vers.el (ediff-vc-latest-version): new function. (ediff-vc-internal): use latest version instead of working version.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 25 Jan 2003 08:09:16 +0000
parents 633233bf2bbf
children 37645a051842
comparison
equal deleted inserted replaced
49427:5c89d088d737 49428:0f80cb4f9d29
50 (load "ediff-init.el" nil nil 'nosuffix)) 50 (load "ediff-init.el" nil nil 'nosuffix))
51 ))) 51 )))
52 ;; end pacifier 52 ;; end pacifier
53 53
54 ;; VC.el support 54 ;; VC.el support
55
56 (defun ediff-vc-latest-version (file)
57 "Return the version level of the latest version of FILE in repository."
58 (if (fboundp 'vc-latest-version)
59 (vc-latest-version file)
60 (or (vc-file-getprop file 'vc-latest-version)
61 (cond ((vc-backend file)
62 (vc-call state file)
63 (vc-file-getprop file 'vc-latest-version))
64 (t (error "File %s is not under version control" file))))
65 ))
66
67
55 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks) 68 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks)
56 ;; Run Ediff on versions of the current buffer. 69 ;; Run Ediff on versions of the current buffer.
57 ;; If REV2 is "" then compare current buffer with REV1. 70 ;; If REV1 is "", use the latest version of the current buffer's file.
58 ;; If the current buffer is named `F', the version is named `F.~REV~'. 71 ;; If REV2 is "" then compare current buffer with REV1.
59 ;; If `F.~REV~' already exists, it is used instead of being re-created. 72 ;; If the current buffer is named `F', the version is named `F.~REV~'.
73 ;; If `F.~REV~' already exists, it is used instead of being re-created.
60 (let (file1 file2 rev1buf rev2buf) 74 (let (file1 file2 rev1buf rev2buf)
75 (if (string= rev1 "")
76 (setq rev1 (ediff-vc-latest-version (buffer-file-name))))
61 (save-window-excursion 77 (save-window-excursion
62 (save-excursion 78 (save-excursion
63 (vc-version-other-window rev1) 79 (vc-version-other-window rev1)
64 (setq rev1buf (current-buffer) 80 (setq rev1buf (current-buffer)
65 file1 (buffer-file-name))) 81 file1 (buffer-file-name)))