[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy 4c1a539 064/173: Added customizable exclusio
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy 4c1a539 064/173: Added customizable exclusion patterns |
Date: |
Sat, 20 Oct 2018 10:36:31 -0400 (EDT) |
branch: externals/ssh-deploy
commit 4c1a539e6f95e4847c13685d2b752e40d2b8aad8
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Added customizable exclusion patterns
---
ssh-deploy.el | 61 +++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 41 insertions(+), 20 deletions(-)
diff --git a/ssh-deploy.el b/ssh-deploy.el
index 52babd0..2f05d3b 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: 9 Jan 2017
-;; Version: 1.49
+;; Modified: 15 Mar 2017
+;; Version: 1.50
;; Keywords: tools, convenience
;; URL: https://github.com/cjohansson/emacs-ssh-deploy
@@ -118,6 +118,11 @@
:type 'boolean
:group 'ssh-deploy)
+(defcustom ssh-deploy-exclude-list '("/.git/" ".dir-locals.el")
+ "List of strings that if found in paths will exclude paths from sync,
'(\"/.git\"/' \".dir-locals.el\") by default."
+ :type 'list
+ :group 'ssh-deploy)
+
(defun ssh-deploy--get-revision-path (path)
"Generate revision-path for PATH."
(if (not (file-exists-p ssh-deploy-revision-folder))
@@ -128,6 +133,16 @@
"Return true if FILE is in the path PATH."
(not (null (string-match path file))))
+(defun ssh-deploy--file-is-included (path)
+ "Return true if PATH is not in the exclusion list."
+ (let ((not-found t))
+ (dolist (element ssh-deploy-exclude-list)
+ (if (and (not (null element))
+ (not (null (string-match element path))))
+ (progn
+ (setq not-found nil))))
+ not-found))
+
(defun ssh-deploy--get-relative-path (root path)
"Return a string for the relative path based on ROOT and PATH."
(replace-regexp-in-string root "" path))
@@ -186,10 +201,10 @@
(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))))))
+ (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))
@@ -316,7 +331,8 @@
;;;### autoload
(defun ssh-deploy (local-root remote-root upload-or-download path debug async
force)
"Upload/Download file or directory relative to the roots LOCAL-ROOT with
REMOTE-ROOT via ssh or ftp according to UPLOAD-OR-DOWNLOAD and the path PATH,
DEBUG enables some feedback messages and ASYNC determines if transfers should
be asynchrous or not, FORCE upload despite external change."
- (if (ssh-deploy--file-is-in-path path local-root)
+ (if (and (ssh-deploy--file-is-in-path path local-root)
+ (ssh-deploy--file-is-included path))
(progn
(let ((file-or-directory (file-regular-p path)))
(let ((remote-path (concat remote-root
(ssh-deploy--get-relative-path local-root path))))
@@ -325,7 +341,7 @@
(ssh-deploy--upload path connection local-root async force)
(ssh-deploy--download connection path local-root async))))))
(if debug
- (message "Path '%s' is not in the root '%s'" path local-root))))
+ (message "Path '%s' is not in the root '%s' or is excluded from it."
path local-root))))
;;;### autoload
(defun ssh-deploy-upload-handler ()
@@ -366,7 +382,8 @@
(let ((local-root (file-truename ssh-deploy-root-local))
(remote-root ssh-deploy-root-remote)
(path (file-truename buffer-file-name)))
- (if (ssh-deploy--file-is-in-path path local-root)
+ (if (and (ssh-deploy--file-is-in-path path local-root)
+ (ssh-deploy--file-is-included path))
(progn
(let ((revision-path (ssh-deploy--get-revision-path path))
(remote-path (concat remote-root
(ssh-deploy--get-relative-path local-root path))))
@@ -390,8 +407,8 @@
(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)))))
+ (message (nth 1 return))
+ (display-warning "ssh-deploy" (nth 1
return) :warning)))))
(progn
(if (file-exists-p remote-path)
(progn
@@ -420,10 +437,10 @@
(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)))))
+ (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
@@ -436,7 +453,7 @@
(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)))))))))))))))
+ (message "Remote file '%s' doesn't exist."
remote-path)))))))))))))))
;;;### autoload
(defun ssh-deploy-download-handler ()
@@ -457,7 +474,8 @@
;;;### autoload
(defun ssh-deploy-diff-handler ()
"Compare current path with remote host if it is configured for deployment."
- (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
(ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
+ (if (and (ssh-deploy--is-not-empty-string ssh-deploy-root-local)
+ (ssh-deploy--is-not-empty-string ssh-deploy-root-remote))
(if (and (ssh-deploy--is-not-empty-string buffer-file-name)
(file-exists-p buffer-file-name))
(let ((local-path (file-truename buffer-file-name))
@@ -489,7 +507,8 @@
(defun ssh-deploy-diff (local-root remote-root-string path &optional debug)
"Find differences relative to the roots LOCAL-ROOT with REMOTE-ROOT-STRING
and the path PATH, DEBUG enables feedback message."
(let ((file-or-directory (file-regular-p path)))
- (if (ssh-deploy--file-is-in-path path local-root)
+ (if (and (ssh-deploy--file-is-in-path path local-root)
+ (ssh-deploy--file-is-included path))
(progn
(let ((remote-path (concat remote-root-string
(ssh-deploy--get-relative-path local-root path))))
(let ((remote (ssh-deploy--parse-remote remote-path)))
@@ -511,12 +530,13 @@
(ztree-diff path command))
(message "ztree-diff is not installed."))))))))
(if debug
- (message "Path '%s' is not in the root '%s'" path local-root)))))
+ (message "Path '%s' is not in the root '%s' or is excluded from it."
path local-root)))))
;;;### autoload
(defun ssh-deploy-browse-remote (local-root remote-root-string path)
"Browse relative to LOCAL-ROOT on REMOTE-ROOT-STRING the path PATH in
`dired-mode`."
- (if (ssh-deploy--file-is-in-path path local-root)
+ (if (and (ssh-deploy--file-is-in-path path local-root)
+ (ssh-deploy--file-is-included path))
(let ((remote-path (concat remote-root-string
(ssh-deploy--get-relative-path local-root path))))
(let ((remote-root (ssh-deploy--parse-remote remote-path)))
(let ((command (concat "/" (alist-get 'protocol remote-root) ":"
(alist-get 'username remote-root) "@" (alist-get 'server remote-root) ":"
(alist-get 'path remote-root))))
@@ -551,3 +571,4 @@
(provide 'ssh-deploy)
;;; ssh-deploy.el ends here
+
- [elpa] externals/ssh-deploy 1f0bdf6 071/173: Create directories on remote When uploading files in a folder that, (continued)
- [elpa] externals/ssh-deploy 1f0bdf6 071/173: Create directories on remote When uploading files in a folder that, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy b1f9e5b 050/173: Now detects remote changes, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy bf86728 068/173: Added deploy command, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy dbd8608 076/173: Improved documentation, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 2eab0ee 091/173: Fixed bug for eshell in base directory, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy c02b0c9 094/173: Removed debug code from directory-diff function, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 68804ee 097/173: Updated use-package README example, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy d2c204f 101/173: Fixed syntax error in example configuration, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4f77b6c 118/173: Silenced code notices and fixes syntax for (display-warning), Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy a3f9ec5 120/173: Now possible to define remote SQL port numbers, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 4c1a539 064/173: Added customizable exclusion patterns,
Stefan Monnier <=
- [elpa] externals/ssh-deploy f9a2785 086/173: Removed tramp-term functionality, supports native TRAMP strings, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy c64013a 099/173: Made directory variables permanent, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 0f5e1dc 108/173: Fixed bug with endless loop, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 088ed22 132/173: Added separators to menu and changed order of items, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 7a2c7b6 138/173: Merge branch 'master' of https://github.com/cjohansson/emacs-ssh-deploy, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy b1713b7 129/173: Added all handlers to new menu, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 7cc936f 140/173: Removed debug comments, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy f8dc6a2 144/173: Renamed mode-line name from SH to DPL, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 76f7740 137/173: Now possible to define remote shell executable path per directory, Stefan Monnier, 2018/10/20
- [elpa] externals/ssh-deploy 9c3f519 145/173: Nicer looking mode-line with square brackets, Stefan Monnier, 2018/10/20