[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy d4953c7 049/173: Fixed upload/download of ro
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy d4953c7 049/173: Fixed upload/download of root directory with different names |
Date: |
Sat, 20 Oct 2018 10:36:28 -0400 (EDT) |
branch: externals/ssh-deploy
commit d4953c70c30b4729012cbe872016d83114f8adb6
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Fixed upload/download of root directory with different names
---
ssh-deploy.el | 99 ++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 64 insertions(+), 35 deletions(-)
diff --git a/ssh-deploy.el b/ssh-deploy.el
index f61aa0b..16ae266 100644
--- a/ssh-deploy.el
+++ b/ssh-deploy.el
@@ -1,4 +1,4 @@
-;;; ssh-deploy.el --- Deployment via SSH, global or per directory.
+;;; `ssh-deploy.el --- Deployment via SSH, global or per directory.
;; Author: Christian Johansson <github.com/cjohansson>
;; Maintainer: Christian Johansson <github.com/cjohansson>
@@ -36,9 +36,9 @@
;; `ssh-deploy-root-local',`ssh-deploy-root-remote',
`ssh-deploy-on-explicit-save'
;; you can setup a directory for SSH or FTP deployment.
;;
-;; For asynchrous transfers you need to setup ~/.netrc or equivalent for
automatic authentifications.
+;; For asynchronous transfers you need to setup `~/.netrc' or equivalent for
automatic authentication.
;;
-;; Example contents of ~/.netrc:
+;; Example contents of `~/.netrc':
;; machine myserver.com login myuser port ftp password mypassword
;;
;; Set permissions to this file to 700 with you as the owner.
@@ -53,17 +53,17 @@
;; (global-set-key (kbd "C-c C-z t") (lambda()
(interactive)(ssh-deploy-remote-terminal-handler) ))
;; (global-set-key (kbd "C-c C-z b") (lambda()
(interactive)(ssh-deploy-browse-remote-handler) ))
;;
-;; An illustrative example for SSH deployment,
/Users/Chris/Web/Site1/.dir.locals.el
+;; An illustrative example for `SSH' deployment,
/Users/Chris/Web/Site1/.dir.locals.el
;; ((nil . (
;; (ssh-deploy-root-local . "/Users/Chris/Web/Site1/")
;; (ssh-deploy-root-remote . "/ssh:address@hidden:/var/www/site1/")
;; (ssh-deploy-on-explicity-save . t)
;; )))
;;
-;; An example for FTP deployment, /Users/Chris/Web/Site2/.dir.locals.el:
+;; An example for `FTP' deployment, /Users/Chris/Web/Site2/.dir.locals.el:
;; ((nil . (
;; (ssh-deploy-root-local . "/Users/Chris/Web/Site2/")
-;; (ssh-deploy-root-remote . "/ftp:address@hidden:/site2/")
+;; (ssh-deploy-root-remote . "/ftp:address@hidden:/var/www/site2/")
;; (ssh-deploy-on-explicit-save . nil)
;; )))
;;
@@ -161,13 +161,22 @@
(lambda(return-path)
(message "Upload '%s' finished" return-path))))
(progn
- (message "Uploading directory '%s' to '%s' via tramp
asynchrously.." local remote-path)
- (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 "Uploading directory '%s' to '%s' via tramp
asynchronously.." local remote-path)
+ (if (string= remote-path (alist-get 'string remote))
+ (progn
+ (async-start
+ `(lambda()
+ (copy-directory ,local ,remote-path t t t)
+ ,local)
+ (lambda(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 "async.el is not installed")))
(defun ssh-deploy--upload-via-tramp (local remote local-root)
@@ -176,23 +185,28 @@
(file-or-directory (file-regular-p local)))
(if file-or-directory
(progn
- (message "Uploading file '%s' to '%s' via tramp synchrously.." local
remote-path)
+ (message "Uploading file '%s' to '%s' via tramp synchronously.."
local remote-path)
(copy-file local remote-path t t t t)
(message "Upload '%s' finished" local))
(progn
- (message "Uploading directory '%s' to '%s' via tramp synchrously.."
local remote-path)
- (copy-directory local (file-name-directory (directory-file-name
remote-path)) t t)
- (message "Upload '%s' finished" local)))))
+ (message "Uploading directory '%s' to '%s' via tramp synchronously.."
local remote-path)
+ (if (string= remote-path (alist-get 'string remote))
+ (progn
+ (copy-directory local remote-path t t t)
+ (message "Upload '%s' finished" local))
+ (progn
+ (copy-directory local (file-name-directory (directory-file-name
remote-path)) t t)
+ (message "Upload '%s' finished" local)))))))
(defun ssh-deploy--download-via-tramp-async (remote local local-root)
- "Download REMOTE path to LOCAL and LOCAL-ROOT via tramp asynchrously."
+ "Download REMOTE path to LOCAL and LOCAL-ROOT via tramp asynchronously."
(if (fboundp 'async-start)
(progn
(let ((remote-path (concat "/" (alist-get 'protocol remote) ":"
(shell-quote-argument (alist-get 'username remote)) "@" (shell-quote-argument
(alist-get 'server remote)) ":" (shell-quote-argument (alist-get 'path
remote))))
(file-or-directory (file-regular-p local)))
(if file-or-directory
(progn
- (message "Downloading file '%s' to '%s' via tramp
asynchrously.." remote-path local)
+ (message "Downloading file '%s' to '%s' via tramp
asynchronously.." remote-path local)
(async-start
`(lambda()
(copy-file ,remote-path ,local t t t t)
@@ -200,28 +214,43 @@
(lambda(return-path)
(message "Download '%s' finished" return-path))))
(progn
- (message "Downloading directory '%s' to '%s' via tramp
asynchrously.." remote-path local)
- (async-start
- `(lambda()
- (copy-directory ,remote-path ,(file-name-directory
(directory-file-name local)) t t)
- ,local)
- (lambda(return-path)
- (message "Download '%s' finished" return-path)))))))
+ (message "Downloading directory '%s' to '%s' via tramp
asynchronously.." remote-path local)
+ (if (string= remote-path (alist-get 'string remote))
+ (progn
+ (async-start
+ `(lambda()
+ (copy-directory ,remote-path ,local t t t)
+ ,local)
+ (lambda(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 "async.el is not installed")))
(defun ssh-deploy--download-via-tramp (remote local local-root)
- "Download REMOTE path to LOCAL and LOCAL-ROOT via tramp synchrously."
+ "Download REMOTE path to LOCAL and LOCAL-ROOT via tramp synchronously."
(let ((remote-path (concat "/" (alist-get 'protocol remote) ":"
(shell-quote-argument (alist-get 'username remote)) "@" (shell-quote-argument
(alist-get 'server remote)) ":" (shell-quote-argument (alist-get 'path
remote))))
(file-or-directory (file-regular-p local)))
(if file-or-directory
(progn
- (message "Downloading file '%s' to '%s' via tramp synchrously.."
remote-path local)
+ (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))
(progn
- (message "Downloading directory '%s' to '%s' via tramp synchrously.."
remote-path local)
- (copy-directory remote-path (file-name-directory (directory-file-name
local)) t t)
- (message "Download '%s' finished" local)))))
+ (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))
+ (progn
+ (copy-directory remote-path (file-name-directory
(directory-file-name remote-path)) t t)
+ (message "Download '%s' finished" local))
+ )))))
(defun ssh-deploy--upload (local remote local-root async)
"Upload LOCAL to REMOTE and LOCAL-ROOT via tramp, ASYNC determines if
transfer should be asynchrous ot not."
@@ -240,8 +269,8 @@
(if (not (null upload-or-download))
(ssh-deploy--upload path connection local-root async)
(ssh-deploy--download connection path local-root async))))))
- (if debug
- (message "Path '%s' is not in the root '%s'" path local-root))))
+ (if debug
+ (message "Path '%s' is not in the root '%s'" path local-root))))
;;;### autoload
(defun ssh-deploy-upload-handler ()
@@ -325,8 +354,8 @@
(ztree-diff path command))
(message "ztree-diff is not installed.")
)))))))
- (if debug
- (message "Path '%s' is not in the root '%s'" path local-root)))))
+ (if debug
+ (message "Path '%s' is not in the root '%s'" path local-root)))))
;;;### autoload
(defun ssh-deploy-browse-remote (local-root remote-root-string path)
- [elpa] externals/ssh-deploy 2257f95 029/173: Fixed upload and downloads of root directories where local root directory name differs from remote root directory name., (continued)
- [elpa] externals/ssh-deploy 2257f95 029/173: Fixed upload and downloads of root directories where local root directory name differs from remote root directory name., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 560ff1d 037/173: Added TRAMP functions and improved messages., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy a86091c 032/173: Broken down diff function into multiple functions to easily add new protocols., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 1e58dc3 040/173: SSH deployment now works via TRAMP instead of SCP, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4a2f947 053/173: Fixed bug where missing remote file used wrong logic, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 61a16be 047/173: Merged remote, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy d599659 015/173: Added support for opening remote terminals, uploads/downloads/differences of directories, browsing remote hosts and fixed a bug where paths with special chars were not handled correctly., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 1af0208 045/173: Cleaned up code structure and isolated functions, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 740c27d 054/173: Fixed message when no base revision exists and remote file equals local file, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy ac7aff8 052/173: Asynchronous detection of remote changes doesn't use any synchronous action, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy d4953c7 049/173: Fixed upload/download of root directory with different names,
Stefan Monnier <=
- [elpa] externals/ssh-deploy 2d2c380 033/173: Implemented FTP via cURL but haven't tested it yet., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy f36ffce 059/173: Added MELPA Stable link, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 29cf0b2 061/173: Added force handler in documentation, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 3ea14de 062/173: Improved README for forced uploads, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy a1ea2c2 025/173: Improved description of complex connections, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 828aca3 022/173: Local path and local root is now evaluated based on their truenames., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy d40d817 027/173: Now displaying asynchrous process output., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy be5451c 019/173: Updated to comments and README, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 78d0641 031/173: Updated version and modification date., Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy e94c9e7 035/173: Updated title of README.md, Stefan Monnier, 2018/10/20