diff 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
line wrap: on
line diff
--- a/lisp/ediff-vers.el	Sat Jan 25 02:45:12 2003 +0000
+++ b/lisp/ediff-vers.el	Sat Jan 25 08:09:16 2003 +0000
@@ -52,12 +52,28 @@
 ;; end pacifier
       
 ;; VC.el support
+
+(defun ediff-vc-latest-version (file)
+  "Return the version level of the latest version of FILE in repository."
+  (if (fboundp 'vc-latest-version)
+      (vc-latest-version file)
+    (or (vc-file-getprop file 'vc-latest-version)
+	(cond ((vc-backend file)
+	       (vc-call state file)
+	       (vc-file-getprop file 'vc-latest-version))
+	      (t (error "File %s is not under version control" file))))
+    ))
+
+
 (defun ediff-vc-internal (rev1 rev2 &optional startup-hooks)
-;; Run Ediff on versions of the current buffer.
-;; If REV2 is "" then compare current buffer with REV1.
-;; If the current buffer is named `F', the version is named `F.~REV~'.
-;; If `F.~REV~' already exists, it is used instead of being re-created.
+  ;; Run Ediff on versions of the current buffer.
+  ;; If REV1 is "", use the latest version of the current buffer's file.
+  ;; If REV2 is "" then compare current buffer with REV1.
+  ;; If the current buffer is named `F', the version is named `F.~REV~'.
+  ;; If `F.~REV~' already exists, it is used instead of being re-created.
   (let (file1 file2 rev1buf rev2buf)
+    (if (string= rev1 "") 
+	(setq rev1 (ediff-vc-latest-version (buffer-file-name))))
     (save-window-excursion
       (save-excursion
 	(vc-version-other-window rev1)