[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ssh-deploy 9c73fef 110/133: Added support for asynchron
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ssh-deploy 9c73fef 110/133: Added support for asynchronous file difference check |
Date: |
Sat, 27 Mar 2021 14:48:54 -0400 (EDT) |
branch: externals/ssh-deploy
commit 9c73fef5ee58cb1860d49f046edb526d217f1267
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added support for asynchronous file difference check
---
ssh-deploy-test.el | 24 +++++++++++-------------
ssh-deploy.el | 34 +++++++++++++++++++++++++---------
2 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
index e10443a..6a62d13 100644
--- a/ssh-deploy-test.el
+++ b/ssh-deploy-test.el
@@ -1,6 +1,6 @@
;;; ssh-deploy-test.el --- Unit and integration tests for ssh-deploy. -*-
lexical-binding:t -*-
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
;; This file is not part of GNU Emacs.
@@ -29,11 +29,9 @@
(autoload 'should "ert")
-(autoload 'ediff-same-file-contents "ediff-util")
-
(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")
@@ -94,7 +92,7 @@
(sleep-for 1))
;; Verify that both files have equal contents
- (should (equal t (ediff-same-file-contents file-a file-b)))
+ (should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
(delete-file file-b)
(delete-file file-a)))
@@ -223,7 +221,7 @@
(sleep-for 1))
;; Verify that both files have equal contents
- (should (equal t (ediff-same-file-contents file-a file-b)))
+ (should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
;; Turn of automatic uploads
(let ((ssh-deploy-on-explicit-save 0))
@@ -237,7 +235,7 @@
(sleep-for 1))
;; Verify that both files have equal contents
- (should (equal nil (ediff-same-file-contents file-a file-b)))
+ (should (equal nil (nth 0 (ssh-deploy--diff-files file-a file-b))))
(ssh-deploy-upload-handler)
(when (> async 0)
@@ -245,7 +243,7 @@
(kill-buffer)
;; Verify that both files have equal contents
- (should (equal t (ediff-same-file-contents file-a file-b)))
+ (should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
;; Delete both test files
(delete-file file-b)
@@ -297,7 +295,7 @@
(kill-buffer)
;; Verify that both files have equal contents
- (should (equal t (ediff-same-file-contents file-a file-b)))
+ (should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
;; Update should not trigger upload
(find-file file-b)
@@ -306,7 +304,7 @@
(kill-buffer)
;; Verify that both files don't have equal contents
- (should (equal nil (ediff-same-file-contents file-a file-b)))
+ (should (equal nil (nth 0 (ssh-deploy--diff-files file-a file-b))))
;; Remote file should signal change now
(if (> async 0)
@@ -394,7 +392,7 @@
(kill-buffer)
;; Verify that both files have equal contents
- (should (equal t (ediff-same-file-contents file-a-1 file-b-1)))
+ (should (equal t (nth 0 (ssh-deploy--diff-files file-a-1 file-b-1))))
;; Create file 2
(find-file file-a-2)
@@ -405,7 +403,7 @@
(kill-buffer)
;; Verify that both files have equal contents
- (should (equal t (ediff-same-file-contents file-a-2 file-b-2)))
+ (should (equal t (nth 0 (ssh-deploy--diff-files file-a-2 file-b-2))))
;; Both files should equal
(should (equal
@@ -419,7 +417,7 @@
(kill-buffer)
;; Verify that both files have equal contents
- (should (equal nil (ediff-same-file-contents file-a-2 file-b-2)))
+ (should (equal nil (nth 0 (ssh-deploy--diff-files file-a-2 file-b-2))))
;; Both files should equal
(should (equal
diff --git a/ssh-deploy.el b/ssh-deploy.el
index 8112354..7c0c4c0 100644
--- a/ssh-deploy.el
+++ b/ssh-deploy.el
@@ -5,8 +5,8 @@
;; Author: Christian Johansson <christian@cvj.se>
;; Maintainer: Christian Johansson <christian@cvj.se>
;; Created: 5 Jul 2016
-;; Modified: 27 Apr 2019
-;; Version: 3.1.2
+;; Modified: 2 May 2019
+;; Version: 3.1.3
;; Keywords: tools, convenience
;; URL: https://github.com/cjohansson/emacs-ssh-deploy
@@ -692,6 +692,10 @@
(set (make-local-variable 'ssh-deploy-automatically-detect-remote-changes)
remote-changes)
(set (make-local-variable 'ssh-deploy-exclude-list) exclude-list)))
+(defun ssh-deploy--diff-files (file-a file-b)
+ "Check difference between FILE-A and FILE-B."
+ (let ((result (ediff-same-file-contents file-a file-b)))
+ (list result file-a file-b)))
;; PUBLIC functions
;;
@@ -699,14 +703,26 @@
;; these functions MUST only use module variables as fall-backs for missing
arguments.
-;; TODO Add support for async version of this function
;;;###autoload
-(defun ssh-deploy-diff-files (file-a file-b)
- "Find difference between FILE-A and FILE-B."
+(defun ssh-deploy-diff-files (file-a file-b &optional async async-with-threads)
+ "Find difference between FILE-A and FILE-B, do it asynchronous if ASYNC is
aboe zero and use threads if ASYNC-WITH-THREADS is above zero."
(message "Comparing file '%s' to '%s'.." file-a file-b)
- (if (ediff-same-file-contents file-a file-b)
- (message "Files have identical contents.")
- (ediff file-a file-b)))
+ (let ((async (or async ssh-deploy-async))
+ (async-with-threads (or async-with-threads
ssh-deploy-async-with-threads)))
+ (if (> async 1)
+ (ssh-deploy--async-process
+ (lambda() (ssh-deploy--diff-files file-a file-b))
+ (lambda(result)
+ (if (nth 0 result)
+ (message "File '%s' and '%s' have identical contents.
(asynchronously)" (nth 1 result) (nth 2 result))
+ (message "File '%s' and '%s' does not have identical contents,
launching ediff.. (asynchronously)" file-a file-b)
+ (ediff file-a file-b)))
+ async-with-threads)
+ (let ((result (ssh-deploy--diff-files file-a file-b)))
+ (if (nth 0 result)
+ (message "File '%s' and '%s' have identical contents.
(synchronously)" (nth 1 result) (nth 2 result))
+ (message "File '%s' and '%s' does not have identical contents,
launching ediff.. (synchronously)" file-a file-b)
+ (ediff file-a file-b))))))
;;;###autoload
@@ -1024,7 +1040,7 @@
(if (and (ssh-deploy--file-is-in-path-p path-local root-local)
(ssh-deploy--file-is-included-p path-local exclude-list))
(if file-or-directory
- (ssh-deploy-diff-files path-local path-remote)
+ (ssh-deploy-diff-files path-local path-remote async
async-with-threads)
(ssh-deploy-diff-directories path-local path-remote on-explicit-save
debug async async-with-threads revision-folder remote-changes exclude-list))
(when debug (message "Path '%s' is not in the root '%s' or is excluded
from it." path-local root-local)))))
- [elpa] externals/ssh-deploy ae5354a 065/133: Fixed issue were remote paths with symlinks didn't work with recursive diff function, (continued)
- [elpa] externals/ssh-deploy ae5354a 065/133: Fixed issue were remote paths with symlinks didn't work with recursive diff function, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 6e37aae 067/133: Added unit test for download, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 8107b9e 073/133: Added unit test for rename and delete, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy e895d6d 079/133: Replaced asynchronous (require) with (autoload), Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 5846974 082/133: Added instructions about how to trigger unit test with async.el integration, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 85a7c37 080/133: Added unit tests for asynchronous operations, Stefan Monnier, 2021/03/27
- [elpa] externals/ssh-deploy 6ddb12b 090/133: All unit tests for remote changes sync and async and compilation passing, Stefan Monnier, 2021/03/27
- [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 <=
- [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, 2021/03/27
- [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