+(declare-function ediff-vc-internal (rev1 rev2 &optional startup-hooks))
+
+;;;###autoload
+(defun vc-version-ediff (files rev1 rev2)
+ "Show differences between revisions of the fileset in the
+repository history using ediff."
+ (interactive (vc-diff-build-argument-list-internal))
+ ;; All that was just so we could do argument completion!
+ (when (and (not rev1) rev2)
+ (error "Not a valid revision range"))
+
+ (message "%s" (format "Finding changes in %s..." (vc-delistify files)))
+
+ ;; Functions ediff-(vc|rcs)-internal use "" instead of nil.
+ (when (null rev1) (setq rev1 ""))
+ (when (null rev2) (setq rev2 ""))
+
+ (cond
+ ;; FIXME We only support running ediff on one file for now.
+ ;; We could spin off an ediff session per file in the file set.
+ ((= (length files) 1)
+ (ediff-load-version-control)
+ (find-file (car files)) ;FIXME: find-file from Elisp is bad.
+ (ediff-vc-internal rev1 rev2 nil))
+ (t
+ (error "More than one file is not supported"))))
+
+;;;###autoload
+(defun vc-ediff (historic &optional not-urgent)
+ "Display diffs between file revisions using ediff.
+Normally this compares the currently selected fileset with their
+working revisions. With a prefix argument HISTORIC, it reads two revision
+designators specifying which revisions to compare.
+
+The optional argument NOT-URGENT non-nil means it is ok to say no to
+saving the buffer."
+ (interactive (list current-prefix-arg t))
+ (if historic
+ (call-interactively 'vc-version-ediff)
+ (when buffer-file-name (vc-buffer-sync not-urgent))
+ (vc-version-ediff (cadr (vc-deduce-fileset t)) nil nil)))
+