[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy d992624 087/133: More work on asynchronous u
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy d992624 087/133: More work on asynchronous unit test of detecting remote changes |
Date: |
Sat, 27 Mar 2021 14:48:49 -0400 (EDT) |
branch: externals/ssh-deploy
commit d99262456789e2615d018961ecbf7f5b33d1b7a6
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
More work on asynchronous unit test of detecting remote changes
---
ssh-deploy-test.el | 52 ++++++++++++++++++++++++++++++++++++++++------------
ssh-deploy.el | 10 ++++++----
2 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
index 0c12dab..61b8026 100644
--- a/ssh-deploy-test.el
+++ b/ssh-deploy-test.el
@@ -46,9 +46,11 @@
(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")
(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."
+ (message "\nTest Download\n")
(let ((directory-a (expand-file-name "test-a/"))
(directory-b (expand-file-name "test-b/")))
@@ -101,6 +103,7 @@
(defun ssh-deploy-test--rename-and-delete (async async-with-threads)
"Test downloads asynchronous if ASYNC is above zero, with threads if
ASYNC-WITH-THREADS is above zero."
+ (message "\nTest Rename and delete\n")
(let ((directory-a (expand-file-name "test-a/"))
(directory-b (expand-file-name "test-b/"))
(filename-old "testfile.txt")
@@ -180,7 +183,7 @@
(defun ssh-deploy-test--upload (async async-with-threads)
"Test uploads asynchronously if ASYNC is above zero, with threads if
ASYNC-WITH-THREADS is above zero."
-
+ (message "\nTest Upload\n")
(let ((directory-a (expand-file-name "test-a/"))
(directory-b (expand-file-name "test-b/")))
@@ -253,6 +256,7 @@
(defun ssh-deploy-test--detect-remote-changes (async async-with-threads)
"Test uploads asynchronously if ASYNC is above zero, with threads if
ASYNC-WITH-THREADS is above zero."
+ (message "\nTest Detect Remote Changes\n")
(let ((directory-a (expand-file-name "test-a/"))
(directory-b (expand-file-name "test-b/")))
@@ -304,7 +308,14 @@
(should (equal nil (ediff-same-file-contents file-a file-b)))
;; Remote file should signal change now
- (should (equal 5 (nth 0 (ssh-deploy--remote-changes-data file-a))))
+ (if (> async 0)
+ (progn
+ (ssh-deploy--async-process
+ (lambda() (ssh-deploy--remote-changes-data file-a))
+ (lambda(response) (should (equal 5 (nth 0 response))))
+ async-with-threads)
+ (sleep-for 1))
+ (should (equal 5 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
;; Open file-a and download remote
(find-file file-a)
@@ -314,7 +325,14 @@
(kill-buffer)
;; Remote file should not signal change now
- (should (equal 4 (nth 0 (ssh-deploy--remote-changes-data file-a))))
+ (if (> async 0)
+ (progn
+ (ssh-deploy--async-process
+ (lambda() (ssh-deploy--remote-changes-data file-a))
+ (lambda(response) (should (equal 4 (nth 0 response))))
+ async-with-threads)
+ (sleep-for 1))
+ (should (equal 4 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
;; Delete both test files
(delete-file file-b)
@@ -343,10 +361,15 @@
"Run test for plug-in."
(let ((ssh-deploy-verbose 1)
(ssh-deploy-debug 1)
- (debug-on-error t))
+ (debug-on-error t)
+ (async-el (fboundp 'async-start))
+ (revision-folder (expand-file-name "revisions")))
(when (and ssh-deploy-verbose
ssh-deploy-debug)
- (if (fboundp 'async-start)
+
+ (setq ssh-deploy-revision-folder revision-folder)
+
+ (if async-el
(message "\nNOTE: Running tests for async.el as well since it's
loaded\n")
(message "\nNOTE: Skipping tests for async.el since it's not
loaded\n"))
@@ -354,25 +377,30 @@
(ssh-deploy-test--file-is-in-path)
(ssh-deploy-test--is-not-empty-string)
+ (ssh-deploy-test--detect-remote-changes 0 0)
+ (when async-el
+ (ssh-deploy-test--detect-remote-changes 1 0))
+ (ssh-deploy-test--detect-remote-changes 1 1)
+
(ssh-deploy-test--upload 0 0)
- (when (fboundp 'async-start)
+ (when async-el
(ssh-deploy-test--upload 1 0))
(ssh-deploy-test--upload 1 1)
(ssh-deploy-test--download 0 0)
- (when (fboundp 'async-start)
+ (when async-el
(ssh-deploy-test--download 1 0))
(ssh-deploy-test--download 1 1)
(ssh-deploy-test--rename-and-delete 0 0)
- (when (fboundp 'async-start)
+ (when async-el
(ssh-deploy-test--rename-and-delete 1 0))
(ssh-deploy-test--rename-and-delete 1 1)
- (ssh-deploy-test--detect-remote-changes 0 0)
- (when (fboundp 'async-start)
- (ssh-deploy-test--detect-remote-changes 1 0))
- (ssh-deploy-test--detect-remote-changes 1 1))))
+ (delete-directory revision-folder t)
+
+
+ )))
(ssh-deploy-test)
diff --git a/ssh-deploy.el b/ssh-deploy.el
index d503ef7..91f74e8 100644
--- a/ssh-deploy.el
+++ b/ssh-deploy.el
@@ -315,7 +315,9 @@
(let ((ssh-deploy-async 0)
(ssh-deploy-async-with-threads 0)
(ssh-deploy-on-explicit-save 0)
- (ssh-deploy-automatically-detect-remote-changes 0))
+ (ssh-deploy-automatically-detect-remote-changes 0)
+ (ssh-deploy-revision-folder ssh-deploy-revision-folder)
+ (ssh-deploy-exclude-list ssh-deploy-exclude-list))
(when ftp-netrc
;; Pass ange-ftp setting to asynchronous process
(defvar ange-ftp-netrc-filename ftp-netrc))
@@ -741,8 +743,8 @@
;; File is a directory ignore
(when (> verbose 0) (message (nth 1 response))))
(3
- ;; Remote file doesn't exist)
- (when (> verbose 0) (message (nth 1 response))))
+ ;; Remote file does not exist
+ (when (message (nth 1 response))))
(4
;; Remote file has not changed
(when (> verbose 0) (message (nth 1 response))))
@@ -750,7 +752,7 @@
;; Remote file has changed in comparison with local revision
(display-warning 'ssh-deploy (nth 1 response) :warning))
(6
- ;; Remote file has changed not in comparison with local file
+ ;; Remote file has not changed in comparison with local file
(copy-file (nth 2 response) (nth 3 response) t t t t)
(when (> verbose 0) (message (nth 1 response))))
(7
- [elpa] externals/ssh-deploy 5871711 052/133: Renamed TRAMP to Tramp and added link to lisp code style, (continued)
- [elpa] externals/ssh-deploy 5871711 052/133: Renamed TRAMP to Tramp and added link to lisp code style, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy e834379 053/133: Updated version, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 2388c00 056/133: Added -p suffix to predicate functions, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy bc93b81 057/133: Updated version, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 4c5b82a 062/133: Added hydra application as shortcut, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 0e98d8e 046/133: Removed unnecessary group, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy c7407ef 069/133: Using (kill-buffer) instead of reverting default-directory in unit tests, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy d9f61e1 071/133: Resolved byte-compilation with optional hydra feature, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy f2cdb1a 077/133: Started on asynchronous tests, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 1073a7c 078/133: Replace more (require) with (autoload), Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy d992624 087/133: More work on asynchronous unit test of detecting remote changes,
Stefan Monnier <=
- [elpa] externals/ssh-deploy 3223f69 094/133: Updated Travis file, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 9b5d3d2 111/133: Fixed bug wih conditonal logic for async file diff, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy bebeaa1 100/133: Updated version to 3.1, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy c4fd187 039/133: Deletion working from diff-mode, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 88300e3 043/133: Improved wording of remote change detection, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy e08b8bb 044/133: Improved documentation, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy b480db9 055/133: Changed (when (not)) to (unless), Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 31cb94d 060/133: Added compile command to makefile and added a .gitignore file, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy d03bd70 068/133: Added unit-test for uploads, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 95e823a 074/133: Fixed issue with byte-compilation warning in new unit tests, Stefan Monnier, 2021/03/27