diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py --- a/hgext/inotify/server.py +++ b/hgext/inotify/server.py @@ -304,6 +304,11 @@ class Watcher(object): dd[fn] = status else: d.pop(fn, None) + elif not status: + # a directory is being removed, check its contents + for subfile, b in oldstatus.copy().iteritems(): + self.updatestatus(wfn + '/' + subfile, None) + def check_deleted(self, key): # Files that had been deleted but were present in the dirstate @@ -473,8 +478,7 @@ class Watcher(object): if evt.mask & inotify.IN_ISDIR: self.scan(wpath) - else: - self.schedule_work(wpath, 'd') + self.schedule_work(wpath, 'd') def process_modify(self, wpath, evt): if self.ui.debugflag: diff --git a/tests/test-inotify-issue1542 b/tests/test-inotify-issue1542 new file mode 100644 --- /dev/null +++ b/tests/test-inotify-issue1542 @@ -0,0 +1,32 @@ +#!/bin/sh + +"$TESTDIR/hghave" inotify || exit 80 + +hg init + +touch a +mkdir dir +touch dir/b +touch dir/c + +echo "[extensions]" >> $HGRCPATH +echo "inotify=" >> $HGRCPATH + +hg add dir/c + +echo % inserve +hg inserve -d --pid-file=hg.pid 2>&1 +cat hg.pid >> "$DAEMON_PIDS" + +hg st + +echo % moving dir out +mv dir ../tmp-test-inotify-issue1542 + +echo % status +hg st + +sleep 1 +echo "Are we able to kill the service? if not, the service died on some error" +kill `cat hg.pid` + diff --git a/tests/test-inotify-issue1542.out b/tests/test-inotify-issue1542.out new file mode 100644 --- /dev/null +++ b/tests/test-inotify-issue1542.out @@ -0,0 +1,11 @@ +% inserve +A dir/c +? a +? dir/b +? hg.pid +% moving dir out +% status +! dir/c +? a +? hg.pid +Are we able to kill the service? if not, the service died on some error