branch: externals/ssh-deploy commit c07b006416daeebf12fdc9e62aaeceda4fd20ca7 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Replaced (file-regular-p) with (not (file-directory-p)) (file-directory-p) has better TRAMP support --- ssh-deploy-diff-mode.el | 10 +++++----- ssh-deploy.el | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ssh-deploy-diff-mode.el b/ssh-deploy-diff-mode.el index 4220b32..c64a15b 100644 --- a/ssh-deploy-diff-mode.el +++ b/ssh-deploy-diff-mode.el @@ -3,8 +3,8 @@ ;; Author: Christian Johansson <github.com/cjohansson> ;; Maintainer: Christian Johansson <github.com/cjohansson> ;; Created: 1 Feb 2018 -;; Modified: 19 Feb 2018 -;; Version: 1.12 +;; Modified: 22 Feb 2018 +;; Version: 1.13 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy @@ -35,7 +35,6 @@ ;;; Code: -;; TODO: Must explicitly send global variables, seems like settings are lost sometimes? ;; TODO: Downloading and deletion of remote files that does not exist on local root does not work? ;; TODO: On some FTP hosts, TRAMP wrongly thinks some files are directories @@ -240,7 +239,8 @@ (debug (cond ((boundp 'ssh-deploy-debug) ssh-deploy-debug)(t nil))) (exclude-list (cond ((boundp 'ssh-deploy-exclude-list) ssh-deploy-exclude-list)(t nil))) (revision-folder (cond ((boundp 'ssh-deploy-revision-folder) ssh-deploy-revision-folder)(t nil)))) - (if (fboundp 'ssh-deploy-delete) + (if (and (fboundp 'ssh-deploy-delete) + (fboundp 'ssh-deploy-delete-both)) (cond ((= section ssh-deploy-diff-mode--section-in-both) (let ((yes-no-prompt (read-string (format "Type 'yes' to confirm that you want to delete the file '%s': " file-name)))) (if (string= yes-no-prompt "yes") @@ -249,7 +249,7 @@ ((= section ssh-deploy-diff-mode--section-only-in-b) (ssh-deploy-delete path-remote async debug)) ((= section ssh-deploy-diff-mode--section-in-both) (ssh-deploy-delete-both path-local root-local root-remote async debug exclude-list)) (t (message "Delete is not available in this section"))) - (display-warning "ssh-deploy" "Function ssh-deploy-delete is missing" :warning)))) + (display-warning "ssh-deploy" "Function ssh-deploy-delete or ssh-deploy-delete-both is missing" :warning)))) (defun ssh-deploy-diff-mode--difference (parts) "If file exists in both start a difference session based on PARTS." diff --git a/ssh-deploy.el b/ssh-deploy.el index 0457cd2..4942f03 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: 19 Feb 2018 -;; Version: 1.77 +;; Modified: 22 Feb 2018 +;; Version: 1.78 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy @@ -242,7 +242,7 @@ (defun ssh-deploy--upload-via-tramp-async (path-local path-remote force revision-folder) "Upload PATH-LOCAL to PATH-REMOTE via TRAMP asynchronously and FORCE upload despite remote change, check for revisions in REVISION-FOLDER." (if (fboundp 'async-start) - (let ((file-or-directory (file-regular-p path-local))) + (let ((file-or-directory (not (file-directory-p path-local)))) (if file-or-directory (let ((revision-path (ssh-deploy--get-revision-path path-local revision-folder))) (message "Uploading file '%s' to '%s'.. (asynchronously)" path-local path-remote) @@ -275,7 +275,7 @@ (defun ssh-deploy--upload-via-tramp (path-local path-remote force revision-folder) "Upload PATH-LOCAL to PATH-REMOTE via TRAMP synchronously and FORCE despite remote change compared with copy in REVISION-FOLDER." - (let ((file-or-directory (file-regular-p path-local)) + (let ((file-or-directory (not (file-directory-p path-local))) (revision-path (ssh-deploy--get-revision-path path-local revision-folder))) (if file-or-directory (progn @@ -305,7 +305,7 @@ (message "Downloading '%s' to '%s'.. (asynchronously)" path-remote path-local) (async-start `(lambda() - (let ((file-or-directory (file-regular-p ,path-remote))) + (let ((file-or-directory (not (file-directory-p ,path-remote)))) (if file-or-directory (progn (copy-file ,path-remote ,path-local t t t t) @@ -318,7 +318,7 @@ (defun ssh-deploy--download-via-tramp (path-remote path-local revision-folder) "Download PATH-REMOTE to PATH-LOCAL via TRAMP synchronously and store a copy in REVISION-FOLDER." - (let ((file-or-directory (file-regular-p path-remote))) + (let ((file-or-directory (not (file-directory-p path-remote)))) (if file-or-directory (progn (message "Downloading file '%s' to '%s'.. (synchronously)" path-remote path-local) @@ -557,7 +557,7 @@ (exclude-list (or exclude-list ssh-deploy-exclude-list)) (revision-path (ssh-deploy--get-revision-path path-local revision-folder)) (path-remote (concat root-remote (ssh-deploy--get-relative-path root-local path-local)))) - (if (file-regular-p path-local) + (if (not (file-directory-p path-local)) (if (file-exists-p revision-path) (if (and async (fboundp 'async-start)) (async-start @@ -624,7 +624,7 @@ (async-start `(lambda() (if (file-exists-p ,path) - (let ((file-or-directory (file-regular-p ,path))) + (let ((file-or-directory (not (file-directory-p ,path)))) (progn (if file-or-directory (delete-file ,path t) @@ -635,7 +635,7 @@ (cond ((= 0 (nth 1 response)) (message "Deleted '%s'. (asynchronously)" (nth 0 response))) (t (display-warning "ssh-deploy" (format "Did not find '%s'. (asynchronously)" (nth 0 response)) :warning))))) (if (file-exists-p path) - (let ((file-or-directory (file-regular-p path))) + (let ((file-or-directory (not (file-directory-p path)))) (progn (if file-or-directory (delete-file path t) @@ -651,7 +651,7 @@ (if (and (ssh-deploy--file-is-in-path path-local root-local) (ssh-deploy--file-is-included path-local exclude-list)) (let ((exclude-list (or exclude-list ssh-deploy-exclude-list)) - (file-or-directory (file-regular-p path-local)) + (file-or-directory (not (file-directory-p path-local))) (path-remote (concat root-remote (ssh-deploy--get-relative-path root-local path-local)))) (ssh-deploy-delete path-local async debug) (kill-this-buffer) @@ -673,11 +673,11 @@ (ssh-deploy--file-is-included old-path-local exclude-list) (ssh-deploy--file-is-included new-path-local exclude-list)) (let ((exclude-list (or exclude-list ssh-deploy-exclude-list)) - (file-or-directory (file-regular-p old-path-local)) + (file-or-directory (not (file-directory-p old-path-local))) (old-path-remote (concat root-remote (ssh-deploy--get-relative-path root-local old-path-local))) (new-path-remote (concat root-remote (ssh-deploy--get-relative-path root-local new-path-local)))) (rename-file old-path-local new-path-local t) - (if (file-regular-p new-path-local) + (if (not (file-directory-p new-path-local)) (progn (rename-buffer new-path-local) (set-buffer-modified-p nil) @@ -739,7 +739,7 @@ ;;;### autoload (defun ssh-deploy-store-revision (path &optional root) "Store PATH in revision-folder ROOT." - (if (file-regular-p path) + (if (not (file-directory-p path)) (let* ((root (or root ssh-deploy-revision-folder)) (revision-path (ssh-deploy--get-revision-path path root))) (message "Storing revision of '%s' at '%s'.." path revision-path) @@ -748,7 +748,7 @@ ;;;### autoload (defun ssh-deploy-diff (path-local path-remote &optional root-local debug exclude-list async) "Find differences between PATH-LOCAL and PATH-REMOTE, where PATH-LOCAL is inside ROOT-LOCAL. DEBUG enables feedback message, check if PATH-LOCAL is not in EXCLUDE-LIST. ASYNC make the process work asynchronously." - (let ((file-or-directory (file-regular-p path-local)) + (let ((file-or-directory (not (file-directory-p path-local))) (exclude-list (or exclude-list ssh-deploy-exclude-list))) (if (not (boundp 'root-local)) (setq root-local ssh-deploy-root-local))