From 01795a1bcf1ff334e4865d50e4dc3aea8c6b6b6e Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 16 Jul 2012 12:19:56 +0200 Subject: [PATCH] * vc/ediff.el (ediff-directories): Add trailing space to prompts. * vc/ediff-diff.el (ediff-same-file-contents): Handle the case, when F1 and F2 are located on different hosts. --- lisp/ChangeLog | 7 +++++++ lisp/vc/ediff-diff.el | 33 +++++++++++++++++++++------------ lisp/vc/ediff.el | 12 ++++++------ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7bb09181b96..929c810ed71 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-07-16 Michael Albinus + + * vc/ediff.el (ediff-directories): Add trailing space to prompts. + + * vc/ediff-diff.el (ediff-same-file-contents): Handle the case, + when F1 and F2 are located on different hosts. + 2012-07-14 Chong Yidong * xt-mouse.el: Implement extended mouse coordinates (Bug#10642). diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index 31a5436acd9..5b31e625a00 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -1406,18 +1406,27 @@ arguments to `skip-chars-forward'." "Return t if files F1 and F2 have identical contents." (if (and (not (file-directory-p f1)) (not (file-directory-p f2))) - (let ((res - ;; In the remote case, this works only if F1 and F2 are - ;; located on the same remote host. - (apply 'process-file ediff-cmp-program nil nil nil - (append ediff-cmp-options - (list (or (file-remote-p f1 'localname) - (expand-file-name f1)) - (or (file-remote-p f2 'localname) - (expand-file-name f2))))) - )) - (and (numberp res) (eq res 0))) - )) + (if (equal (file-remote-p f1) (file-remote-p f2)) + (let ((res + ;; In the remote case, this works only if F1 and F2 are + ;; located on the same remote host. + (apply 'process-file ediff-cmp-program nil nil nil + (append ediff-cmp-options + (list (or (file-remote-p f1 'localname) + (expand-file-name f1)) + (or (file-remote-p f2 'localname) + (expand-file-name f2))))) + )) + (and (numberp res) (eq res 0))) + + ;; F1 and F2 are not located on the same host. + (let ((t1 (file-local-copy f1)) + (t2 (file-local-copy f2))) + (unwind-protect + (ediff-same-file-contents (or t1 f1) (or t2 f2)) + (and t1 (delete-file t1)) + (and t2 (delete-file t2)))) + ))) (defun ediff-same-contents (d1 d2 &optional filter-re) diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index a1f3b72942f..9a20afd90cb 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -491,12 +491,12 @@ If this file is a backup, `ediff' it with its original." (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) (if (stringp buf-C-file-name) (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) - + (setq file-A (ediff-make-temp-file buf-A buf-A-file-name) file-B (ediff-make-temp-file buf-B buf-B-file-name)) (if buf-C-is-alive (setq file-C (ediff-make-temp-file buf-C buf-C-file-name))) - + (ediff-setup (get-buffer buf-A) file-A (get-buffer buf-B) file-B (if buf-C-is-alive (get-buffer buf-C)) @@ -542,8 +542,8 @@ expression; only file names that match the regexp are considered." (default-regexp (eval ediff-default-filtering-regexp)) f) (list (setq f (read-directory-name - "Directory A to compare:" dir-A nil 'must-match)) - (read-directory-name "Directory B to compare:" + "Directory A to compare: " dir-A nil 'must-match)) + (read-directory-name "Directory B to compare: " (if ediff-use-last-dir ediff-last-dir-B (ediff-strip-last-dir f)) @@ -1072,7 +1072,7 @@ lines. For small regions, use `ediff-regions-wordwise'." (ediff-with-current-buffer buffer-B (setq beg-B (move-marker (make-marker) beg-B) end-B (move-marker (make-marker) end-B))) - + ;; make file-A (if word-mode (ediff-wordify beg-A end-A buffer-A tmp-buffer) @@ -1084,7 +1084,7 @@ lines. For small regions, use `ediff-regions-wordwise'." (ediff-wordify beg-B end-B buffer-B tmp-buffer) (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer)) (setq file-B (ediff-make-temp-file tmp-buffer "regB")) - + (setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A)) (setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B)) (ediff-setup buffer-A file-A -- 2.39.2