branch: externals/ssh-deploy commit 0e32ab36c6da602894d4c15c25e736fd03a9600e Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added support for detection of external changes in FTP and improved async signals --- ssh-deploy.el | 116 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 57 insertions(+), 59 deletions(-) diff --git a/ssh-deploy.el b/ssh-deploy.el index 5f050e2..e334e95 100644 --- a/ssh-deploy.el +++ b/ssh-deploy.el @@ -3,8 +3,8 @@ ;; Author: Christian Johansson <github.com/cjohansson> ;; Maintainer: Christian Johansson <github.com/cjohansson> ;; Created: 5 Jul 2016 -;; Modified: 15 Dec 2016 -;; Version: 1.47 +;; Modified: 20 Dec 2016 +;; Version: 1.48 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy @@ -176,20 +176,20 @@ (async-start `(lambda() (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn - (if (or (not (file-exists-p ,remote-path)) (and (file-exists-p ,revision-path) (ediff-same-contents ,revision-path ,remote-path))) + (if (or (not (file-exists-p ,remote-path)) (and (file-exists-p ,revision-path) (ediff-same-file-contents ,revision-path ,remote-path))) (progn (message "Uploading file '%s' to '%s' via tramp asynchronously.." ,local ,remote-path) (copy-file ,local ,remote-path t t t t) (copy-file ,local ,revision-path t t t t) - 0) - 1)) - 2)) - (lambda(return-message) - (if (= return-message 0) (message "Upload completed.") - (if (= return-message 1) (display-warning "ssh-deploy" "External file has changed, please download or diff." :warning) - (if (= return-message 2) (display-warning "ssh-deploy" "Function ediff-same-contents is missing" :warning)))))))) + (list 0 (format "Upload '%s' completed." ,remote-path))) + (list 1 (format "External file '%s' has changed, please download or diff." ,remote-path)))) + (list 1 "Function ediff-same-file-contents is missing."))) + (lambda(return) + (if (= (nth 0 return) 0) + (message (nth 1 return)) + (display-warning "ssh-deploy" (nth 1 return) :warning)))))) (progn (message "Uploading directory '%s' to '%s' via tramp asynchronously.." local remote-path) (if (string= remote-path (alist-get 'string remote)) @@ -199,14 +199,14 @@ (copy-directory ,local ,remote-path t t t) ,local) (lambda(return-path) - (message "Upload '%s' finished" return-path)))) + (message "Upload '%s' finished." return-path)))) (progn (async-start `(lambda() (copy-directory ,local ,(file-name-directory (directory-file-name remote-path)) t t) ,local) (lambda(return-path) - (message "Upload '%s' finished" return-path))))))))) + (message "Upload '%s' finished." return-path))))))))) (message "async.el is not installed"))) (defun ssh-deploy--upload-via-tramp (local remote local-root) @@ -246,7 +246,7 @@ (copy-file ,remote-path ,local t t t t) ,local) (lambda(return-path) - (message "Download '%s' finished" return-path) + (message "Download '%s' finished." return-path) (ssh-deploy-store-revision return-path)))) (progn (message "Downloading directory '%s' to '%s' via tramp asynchronously.." remote-path local) @@ -257,14 +257,14 @@ (copy-directory ,remote-path ,local t t t) ,local) (lambda(return-path) - (message "Download '%s' finished" return-path)))) + (message "Download '%s' finished." return-path)))) (progn (async-start `(lambda() (copy-directory ,remote-path ,(file-name-directory (directory-file-name remote-path)) t t) ,local) (lambda(return-path) - (message "Download '%s' finished" return-path))))))))) + (message "Download '%s' finished." return-path))))))))) (message "async.el is not installed"))) (defun ssh-deploy--download-via-tramp (remote local local-root) @@ -275,17 +275,17 @@ (progn (message "Downloading file '%s' to '%s' via tramp synchronously.." remote-path local) (copy-file remote-path local t t t t) - (message "Download '%s' finished" local) + (message "Download '%s' finished." local) (ssh-deploy-store-revision local)) (progn (message "Downloading directory '%s' to '%s' via tramp synchronously.." remote-path local) (if (string= remote-path (alist-get 'string remote)) (progn (copy-directory remote-path local t t t) - (message "Download '%s' finished" local)) + (message "Download '%s' finished." local)) (progn (copy-directory remote-path (file-name-directory (directory-file-name remote-path)) t t) - (message "Download '%s' finished" local)) + (message "Download '%s' finished." local)) ))))) (defun ssh-deploy--upload (local remote local-root async) @@ -302,13 +302,13 @@ (if (file-exists-p revision-path) (progn (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn - (if (not (ediff-same-contents revision-path remote)) + (if (not (ediff-same-file-contents revision-path remote)) t nil)) (progn - (message "Function ediff-same-contents is missing.") + (message "Function ediff-same-file-contents is missing.") nil))) t)) nil))) @@ -366,29 +366,28 @@ (if (file-exists-p ,remote-path) (progn (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn - (if (ediff-same-contents ,revision-path ,remote-path) - 0 - 1)) - 2)) - 3)) - (lambda(return-message) - (if (= return-message 0) (message "Remote file has not changed.") - (if (= return-message 1) (display-warning "ssh-deploy" "External file has changed, please download or diff." :warning) - (if (= return-message 2) (display-warning "ssh-deploy" "Function ediff-same-contents is missing" :warning) - (if (= return-message 3) (message "Remote file doesn't exist.")))))))) + (if (ediff-same-file-contents ,revision-path ,remote-path) + (list 0 (format "Remote file '%s' has not changed." ,remote-path)) + (list 1 (format "External file '%s' has changed, please download or diff." ,remote-path)))) + (list 1 "Function ediff-same-file-contents is missing."))) + (list 0 (format "Remote file '%s' doesn't exist." ,remote-path)))) + (lambda(return) + (if (= (nth 0 return) 0) + (message (nth 1 return)) + (display-warning "ssh-deploy" (nth 1 return) :warning))))) (progn (if (file-exists-p remote-path) (progn (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn - (if (ediff-same-contents revision-path remote-path) - (message "Remote file has not changed.") - (display-warning "ssh-deploy" "External file has changed, please download or diff." :warning))) - (display-warning "ssh-deploy" "Function ediff-same-contents is missing" :warning))) - (message "Remote file doesn't exist."))))) + (if (ediff-same-file-contents revision-path remote-path) + (message "Remote file '%s' has not changed." remote-path) + (display-warning "ssh-deploy" (format "External file '%s' has changed, please download or diff." remote-path) :warning))) + (display-warning "ssh-deploy" "Function ediff-same-file-contents is missing." :warning))) + (message "Remote file '%s' doesn't exist." remote-path))))) (progn (if (fboundp 'async-start) (progn @@ -397,33 +396,32 @@ (if (file-exists-p ,remote-path) (progn (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn - (if (ediff-same-contents ,path ,remote-path) + (if (ediff-same-file-contents ,path ,remote-path) (progn (copy-file ,path ,revision-path t t t t) - 0) - 1)) - 2)) - 3)) - (lambda(return-message) - (if (= return-message 0) (message "Remote file has not changed, created base revision.") - (if (= return-message 1) (display-warning "ssh-deploy" "External file has changed, please download or diff." :warning) - (if (= return-message 2) (display-warning "ssh-deploy" "Function ediff-same-contents is missing" :warning) - (if (= return-message 3) (message "Remote file doesn't exist.")))))))) + (list 0 (format "Remote file '%s' has not changed, created base revision." ,remote-path))) + (list 1 (format "External file has '%s' changed, please download or diff." ,remote-path)))) + (list 1 "Function ediff-file-same-contents is missing"))) + (list 0 (format "Remote file '%s' doesn't exist." ,remote-path)))) + (lambda(return) + (if (= (nth 0 return) 0) + (message (nth 1 return)) + (display-warning "ssh-deploy" (nth 1 return) :warning))))) (progn (if (file-exists-p remote-path) (progn (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn - (if (ediff-same-contents path remote-path) + (if (ediff-same-file-contents path remote-path) (progn (copy-file path revision-path t t t t) - (message "Remote file has not changed, created base revision.")) - (display-warning "ssh-deploy" "External file has changed, please download or diff." :warning))) - (display-warning "ssh-deploy" "Function ediff-same-contents is missing" :warning))) - (message "Remote file doesn't exist"))))))))))))))) + (message "Remote file '%s' has not changed, created base revision." remote-path)) + (display-warning "ssh-deploy" (format "External file '%s' has changed, please download or diff." remote-path) :warning))) + (display-warning "ssh-deploy" "Function ediff-same-file-contents is missing." :warning))) + (message "Remote file '%s' doesn't exist." remote-path))))))))))))))) ;;;### autoload (defun ssh-deploy-download-handler () @@ -484,13 +482,13 @@ (if file-or-directory (progn (require 'ediff) - (if (fboundp 'ediff-same-contents) + (if (fboundp 'ediff-same-file-contents) (progn (message "Comparing file '%s' to '%s'.." path command) - (if (ediff-same-contents path command) + (if (ediff-same-file-contents path command) (message "Files have identical contents.") (ediff path command))) - (message "Function ediff-same-contents is missing."))) + (message "Function ediff-same-file-contents is missing."))) (progn (if (fboundp 'ztree-diff) (progn