[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/kqueue c8e266f 13/18: Handle more complex rename o
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] scratch/kqueue c8e266f 13/18: Handle more complex rename operation in kqueue |
Date: |
Wed, 25 Nov 2015 14:11:19 +0000 |
branch: scratch/kqueue
commit c8e266ff5f1862567a9f4b77b2d90b8586b12539
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Handle more complex rename operation in kqueue
* src/kqueue.c (pending_events): New variable.
(kqueue_compare_dir_list): Handle more complex rename operation.
(globals_of_kqueue): Initialize pending_events.
* test/automated/file-notify-tests.el (file-notify-test06-many-events):
Adapt expected events in the `rename-file' case.
(file-notify-test06-many-events-remote): Declare.
---
src/kqueue.c | 25 +++++++++++++++++++------
test/automated/file-notify-tests.el | 10 ++++------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/src/kqueue.c b/src/kqueue.c
index e2c9dab..fa54176 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -35,6 +35,10 @@ static int kqueuefd = -1;
/* This is a list, elements are (DESCRIPTOR FILE FLAGS CALLBACK [DIRLIST]). */
static Lisp_Object watch_list;
+/* Pending events, being the target of a rename operation.
+ Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE). */
+static Lisp_Object pending_events;
+
/* Generate a list from the directory_files_internal output.
Items are (INODE FILE-NAME LAST-MOD LAST-STATUS-MOD SIZE). */
Lisp_Object
@@ -136,7 +140,7 @@ kqueue_compare_dir_list
/* Search for an entry with the same inode. */
old_entry = XCAR (dl);
- new_entry = Fassoc (XCAR (old_entry), new_dl);
+ new_entry = assq_no_quit (XCAR (old_entry), new_dl);
if (! NILP (Fequal (old_entry, new_entry))) {
/* Both entries are identical. Nothing to do. */
new_dl = Fdelq (new_entry, new_dl);
@@ -177,16 +181,24 @@ kqueue_compare_dir_list
new_entry = XCAR (dl1);
if (strcmp (SSDATA (XCAR (XCDR (old_entry))),
SSDATA (XCAR (XCDR (new_entry)))) == 0) {
- kqueue_generate_event
- (watch_object, Fcons (Qwrite, Qnil), XCAR (XCDR (old_entry)), Qnil);
+ pending_events = Fcons (new_entry, pending_events);
new_dl = Fdelq (new_entry, new_dl);
goto the_end;
}
}
- /* The file has been deleted. */
- kqueue_generate_event
- (watch_object, Fcons (Qdelete, Qnil), XCAR (XCDR (old_entry)), Qnil);
+ new_entry = assq_no_quit (XCAR (old_entry), pending_events);
+ if (NILP (new_entry))
+ /* The file has been deleted. */
+ kqueue_generate_event
+ (watch_object, Fcons (Qdelete, Qnil), XCAR (XCDR (old_entry)), Qnil);
+ else {
+ /* The file has been renamed. */
+ kqueue_generate_event
+ (watch_object, Fcons (Qrename, Qnil),
+ XCAR (XCDR (old_entry)), XCAR (XCDR (new_entry)));
+ new_dl = Fdelq (new_entry, new_dl);
+ }
the_end:
dl = XCDR (dl);
@@ -444,6 +456,7 @@ void
globals_of_kqueue (void)
{
watch_list = Qnil;
+ pending_events = Qnil;
}
void
diff --git a/test/automated/file-notify-tests.el
b/test/automated/file-notify-tests.el
index f0068c5..b9cd192 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -661,12 +661,7 @@ Don't wait longer than timeout seconds for the events to
be delivered."
(write-region "" nil file nil 'no-message))
(dolist (file y-file-list)
(write-region "" nil file nil 'no-message)))
- (file-notify--test-with-events (cond
- ;; XXX Different results?
- ((featurep 'kqueue)
- (append (make-list n 'changed)
- (make-list n 'deleted)))
- (t (make-list n 'renamed)))
+ (file-notify--test-with-events (make-list n 'renamed)
(let ((x-file-list x-file-list)
(y-file-list y-file-list))
(while (and x-file-list y-file-list)
@@ -676,6 +671,9 @@ Don't wait longer than timeout seconds for the events to be
delivered."
(delete-file file))))
(file-notify--test-cleanup)))
+(file-notify--deftest-remote file-notify-test06-many-events
+ "Check that events are not dropped remote directories.")
+
(defun file-notify-test-all (&optional interactive)
"Run all tests for \\[file-notify]."
(interactive "p")
- [Emacs-diffs] scratch/kqueue updated (15e7544 -> e604e6a), Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue c571fc1 04/18: Build fixes for kqueue support., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue e0a68f2 03/18: Continue kqueue implementation, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 90d6c69 07/18: * lisp/filenotify.el (file-notify-add-watch): Fix thinko., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 99aa855 09/18: Doc changes for kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 7543d1c 02/18: Work on kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 5044bdf 12/18: New test with a larger number of events., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 13f3508 10/18: Code cleanup of kqueue.c, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue e95b309 06/18: More work on kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue c8e266f 13/18: Handle more complex rename operation in kqueue,
Michael Albinus <=
- [Emacs-diffs] scratch/kqueue 65ba5a9 11/18: Further fixes for kqueue., Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 8deebe1 08/18: Finish implementation in kqueue.c, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 6b490c0 14/18: Improve loops in file-notify-test06-many-events, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 5154781 15/18: Continie with pending events, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue e604e6a 18/18: Merge branch 'scratch/kqueue' of git.sv.gnu.org:/srv/git/emacs into scratch/kqueue, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 0247489 16/18: Rework file notifications, kqueue has problems with directory monitors, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue 41d9bd0 05/18: Implement directory events, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue e3354e2 01/18: Add kqueue support, Michael Albinus, 2015/11/25
- [Emacs-diffs] scratch/kqueue bec57a4 17/18: Some final fixes in file notification before merging with master, Michael Albinus, 2015/11/25