summaryrefslogtreecommitdiff
path: root/lisp/ediff-vers.el
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>2003-01-25 08:09:16 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>2003-01-25 08:09:16 +0000
commit0831d50c9061dd88a9494af80e3264dad5de8647 (patch)
tree8e0b4508405533177dd495aa289e7cfe7e711bf4 /lisp/ediff-vers.el
parent505b68d57d732e359570a61ce37a20c6c19f0a8d (diff)
downloademacs-0831d50c9061dd88a9494af80e3264dad5de8647.tar.gz
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.
Diffstat (limited to 'lisp/ediff-vers.el')
-rw-r--r--lisp/ediff-vers.el24
1 files changed, 20 insertions, 4 deletions
diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el
index 88d4ea16d7b..03bc171a657 100644
--- a/lisp/ediff-vers.el
+++ b/lisp/ediff-vers.el
@@ -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)