[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy 567e1d5 120/133: Work on feature to automati
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy 567e1d5 120/133: Work on feature to automatically update revisions |
Date: |
Sat, 27 Mar 2021 14:48:56 -0400 (EDT) |
branch: externals/ssh-deploy
commit 567e1d55ffdb022752d3854f67ca6c5fe669f24d
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Work on feature to automatically update revisions
---
ssh-deploy-diff-mode.el | 8 +-------
ssh-deploy-test.el | 44 ++++++++++++++++++++++++--------------------
ssh-deploy.el | 10 ++++++++--
3 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/ssh-deploy-diff-mode.el b/ssh-deploy-diff-mode.el
index 52abf6f..debed5d 100644
--- a/ssh-deploy-diff-mode.el
+++ b/ssh-deploy-diff-mode.el
@@ -23,13 +23,7 @@
;;; Code:
-
-(autoload 'ssh-deploy-diff-directories "ssh-deploy")
-(autoload 'ssh-deploy-upload "ssh-deploy")
-(autoload 'ssh-deploy-download "ssh-deploy")
-(autoload 'ssh-deploy-delete-both "ssh-deploy")
-(autoload 'ssh-deploy-delete "ssh-deploy")
-(autoload 'ssh-deploy-diff-files "ssh-deploy")
+(require 'ssh-deploy)
(defconst ssh-deploy-diff-mode--keywords
'(
diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
index 9cfa927..ce507e6 100644
--- a/ssh-deploy-test.el
+++ b/ssh-deploy-test.el
@@ -29,23 +29,8 @@
(autoload 'should "ert")
-(autoload 'ssh-deploy-diff-mode "ssh-deploy-diff-mode")
-(autoload 'ssh-deploy--diff-directories-data "ssh-deploy-diff-mode")
-(autoload 'ssh-deploy--diff-files "ssh-deploy")
-(autoload 'ssh-deploy "ssh-deploy")
-(autoload 'ssh-deploy--get-revision-path "ssh-deploy")
-(autoload 'ssh-deploy--file-is-in-path-p "ssh-deploy")
-(autoload 'ssh-deploy--is-not-empty-string-p "ssh-deploy")
-(autoload 'ssh-deploy-download "ssh-deploy")
-(autoload 'ssh-deploy-upload "ssh-deploy")
-(autoload 'ssh-deploy-rename "ssh-deploy")
-(autoload 'ssh-deploy-delete-both "ssh-deploy")
-(autoload 'ssh-deploy-add-after-save-hook "ssh-deploy")
-(autoload 'ssh-deploy-add-after-save-hook "ssh-deploy")
-(autoload 'ssh-deploy-upload-handler "ssh-deploy")
-(autoload 'ssh-deploy--remote-changes-data "ssh-deploy")
-(autoload 'ssh-deploy-download-handler "ssh-deploy")
-(autoload 'ssh-deploy--async-process "ssh-deploy")
+(require 'ssh-deploy)
+(require 'ssh-deploy-diff-mode)
(defun ssh-deploy-test--download (async async-with-threads)
"Test downloads asynchronously if ASYNC is above zero, with threads if
ASYNC-WITH-THREADS is above zero."
@@ -276,7 +261,8 @@
(ssh-deploy-on-explicit-save 1)
(ssh-deploy-debug 0)
(ssh-deploy-async async)
- (ssh-deploy-async-with-threads async-with-threads))
+ (ssh-deploy-async-with-threads async-with-threads)
+ (revision-file (ssh-deploy--get-revision-path file-a
ssh-deploy-revision-folder)))
;; Just bypass the linter here
(when (and ssh-deploy-root-local
@@ -297,14 +283,16 @@
;; Verify that both files have equal contents
(should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
+ ;; Modify local revision here
+
;; Update should not trigger upload
- (find-file file-b)
+ (find-file revision-file)
(insert "Random blob")
(save-buffer)
(kill-buffer)
;; Verify that both files don't have equal contents
- (should (equal nil (nth 0 (ssh-deploy--diff-files file-a file-b))))
+ (should (equal nil (nth 0 (ssh-deploy--diff-files file-a
revision-file))))
;; Remote file should signal change now
(if (> async 0)
@@ -316,6 +304,22 @@
(sleep-for 1))
(should (equal 5 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
+ ;; Update should now trigger upload
+ (find-file file-a)
+ (insert "Random blob")
+ (save-buffer)
+ (kill-buffer)
+
+ ;; Remote file should signal change now
+ (if (> async 0)
+ (progn
+ (ssh-deploy--async-process
+ (lambda() (ssh-deploy--remote-changes-data file-a))
+ (lambda(response) (should (equal 8 (nth 0 response))))
+ async-with-threads)
+ (sleep-for 1))
+ (should (equal 8 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
+
;; Open file-a and download remote
(find-file file-a)
(ssh-deploy-download-handler)
diff --git a/ssh-deploy.el b/ssh-deploy.el
index 5258406..0c7e0cd 100644
--- a/ssh-deploy.el
+++ b/ssh-deploy.el
@@ -796,7 +796,11 @@
(when (> verbose 0) (message (nth 1 response))))
(7
;; Remote file has changed in comparison with local file
- (display-warning 'ssh-deploy (nth 1 response) :warning))))
+ (display-warning 'ssh-deploy (nth 1 response) :warning))
+ (8
+ ;; Remote file has changed in comparison with local revision but not
local file
+ (copy-file (nth 2 response) (nth 3 response) t t t t)
+ (when (> verbose 0) (message (nth 1 response))))))
(defun ssh-deploy--remote-changes-data (path-local &optional root-local
root-remote revision-folder exclude-list)
"Check if a local revision for PATH-LOCAL on ROOT-LOCAL and if remote file
has changed on ROOT-REMOTE, check for copies in REVISION-FOLDER and skip if
path is in EXCLUDE-LIST. Should only return status-code and message."
@@ -822,7 +826,9 @@
(if (nth 0 (ssh-deploy--diff-files revision-path
path-remote))
(list 4 (format "Remote file '%s' has not
changed." path-remote) path-local)
- (list 5 (format "Remote file '%s' has changed
compared to local revision, please download or diff." path-remote) path-local
revision-path))
+ (if (nth 0 (ssh-deploy--diff-files path-local
path-remote))
+ (list 5 (format "Remote file '%s' has changed
compared to local revision and local file, please download or diff."
path-remote) path-local revision-path)
+ (list 8 (format "Remote file '%s' has changed
compared to local revision but not local file, copied local file to local
revision." path-remote) path-local revision-path)))
(if (nth 0 (ssh-deploy--diff-files path-local
path-remote))
(list 6 (format "Remote file '%s' has not changed
compared to local file, created local revision." path-remote) path-local
revision-path)
- [elpa] externals/ssh-deploy 8e2507b 085/133: Refactored remote changes function and made unit tests for it, (continued)
- [elpa] externals/ssh-deploy 8e2507b 085/133: Refactored remote changes function and made unit tests for it, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 8c26f61 091/133: Updated version and change-date, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 6d20dae 109/133: Fixed issue were async directory diff would lock main thread for resolving file links when using the handler, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 9c73fef 110/133: Added support for asynchronous file difference check, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 045e463 095/133: Trying emacs version manager in travis, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 438c1b4 107/133: Do not allow failures on emacs snapshot, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 24fec85 096/133: Added Travis build status to README, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 316395c 089/133: Updated version and date, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy f462007 105/133: More work on directory difference unit test, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 2f6a36e 101/133: Improved instructions for hydra and use-package, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 567e1d5 120/133: Work on feature to automatically update revisions,
Stefan Monnier <=
- [elpa] externals/ssh-deploy 2c43901 112/133: Using ssh-deploy--diff-files instead of directly ediff-same-file-contents, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy aa93c35 123/133: Concatenation of remote file now done properly for directory diff, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 009e9f8 113/133: Added mode-line status for checking file difference, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 016444c 122/133: Fixed bug with directory difference from deployment root or piped remote files, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy f910a4d 115/133: Passing verbose flag to remote changes handler, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy d924c73 124/133: Merge pull request #60 from ShuguangSun/master, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy a6629c1 130/133: Update ssh-deploy.el, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 1bb2f82 129/133: Added support for forced uploads on explicit save actions, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy cc91b56 132/133: Updated README and version, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy e73907d 063/133: Changed test command, Stefan Monnier, 2021/03/27