emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ssh-deploy d0f7294 121/133: When remote differs only wi


From: Stefan Monnier
Subject: [elpa] externals/ssh-deploy d0f7294 121/133: When remote differs only with local-revision, update local-revision [#61]
Date: Sat, 27 Mar 2021 14:48:56 -0400 (EDT)

branch: externals/ssh-deploy
commit d0f7294d23380766dcabdb4ed21bc6a68e496110
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    When remote differs only with local-revision, update local-revision [#61]
---
 ssh-deploy-test.el | 27 ++++++++++++++++++---------
 ssh-deploy.el      | 10 +++++-----
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/ssh-deploy-test.el b/ssh-deploy-test.el
index ce507e6..9f9fc94 100644
--- a/ssh-deploy-test.el
+++ b/ssh-deploy-test.el
@@ -272,6 +272,7 @@
                  ssh-deploy-async
                  ssh-deploy-async-with-threads)
 
+        ;; Modify local file, remote file should be automatically uploaded
         (ssh-deploy-add-after-save-hook)
         (find-file file-a)
         (insert file-a-contents)
@@ -281,17 +282,16 @@
         (kill-buffer)
 
         ;; Verify that both files have equal contents
+        (should (equal t (nth 0 (ssh-deploy--diff-files file-a 
revision-file))))
         (should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
 
-        ;; Modify local revision here
-
-        ;; Update should not trigger upload
+        ;; Modify only local revision
         (find-file revision-file)
         (insert "Random blob")
         (save-buffer)
         (kill-buffer)
 
-        ;; Verify that both files don't have equal contents
+        ;; Verify that both files don't have equal contents anymore
         (should (equal nil (nth 0 (ssh-deploy--diff-files file-a 
revision-file))))
 
         ;; Remote file should signal change now
@@ -299,13 +299,22 @@
             (progn
               (ssh-deploy--async-process
                (lambda() (ssh-deploy--remote-changes-data file-a))
-               (lambda(response) (should (equal 5 (nth 0 response))))
+               (lambda(response)
+                 (should (equal 8 (nth 0 response))))
                async-with-threads)
               (sleep-for 1))
-          (should (equal 5 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
+          (let ((response (ssh-deploy--remote-changes-data file-a)))
+            (should (equal 8 (nth 0 response)))))
+
+        ;; Run post-executor that should copy local-file to revision-file
+        (ssh-deploy--remote-changes-post-executor (list 8 "" file-a 
revision-file) ssh-deploy-verbose)
+
+        ;; Verify that both files have equal contents again
+        (should (equal t (nth 0 (ssh-deploy--diff-files file-a 
revision-file))))
+        (should (equal t (nth 0 (ssh-deploy--diff-files file-a file-b))))
 
         ;; Update should now trigger upload
-        (find-file file-a)
+        (find-file file-b)
         (insert "Random blob")
         (save-buffer)
         (kill-buffer)
@@ -315,10 +324,10 @@
             (progn
               (ssh-deploy--async-process
                (lambda() (ssh-deploy--remote-changes-data file-a))
-               (lambda(response) (should (equal 8 (nth 0 response))))
+               (lambda(response) (should (equal 5 (nth 0 response))))
                async-with-threads)
               (sleep-for 1))
-          (should (equal 8 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
+          (should (equal 5 (nth 0 (ssh-deploy--remote-changes-data file-a)))))
 
         ;; Open file-a and download remote
         (find-file file-a)
diff --git a/ssh-deploy.el b/ssh-deploy.el
index 0c7e0cd..ff86e4a 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: 10 Jun 2019
-;; Version: 3.1.5
+;; Modified: 17 Aug 2019
+;; Version: 3.1.6
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-ssh-deploy
 
@@ -788,7 +788,7 @@
      ;; Remote file has not changed
      (when (> verbose 0) (message (nth 1 response))))
     (5
-     ;; Remote file has changed in comparison with local revision
+     ;; Remote file has changed in comparison with local revision but also 
with local file
      (display-warning 'ssh-deploy (nth 1 response) :warning))
     (6
      ;; Remote file has not changed in comparison with local file
@@ -827,8 +827,8 @@
                           (if (nth 0 (ssh-deploy--diff-files revision-path 
path-remote))
                               (list 4 (format "Remote file '%s' has not 
changed." path-remote) path-local)
                             (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)))
+                                (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)
+                              (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)))
 
                         (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]