inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Mon, 13 Jul 2009 21:55:17 +0900
changeset 9117 a87bc6e2a907
parent 9116 f90bbf1ea09f
child 9119 294c5e460b36
child 9134 a5c060b80082
inotify: server: explicitely ignore events in subdirs of .hg/ (issue1735)
hgext/inotify/server.py
tests/test-inotify
tests/test-inotify.out
--- a/hgext/inotify/server.py	Mon Jul 13 16:49:05 2009 +0200
+++ b/hgext/inotify/server.py	Mon Jul 13 21:55:17 2009 +0900
@@ -636,6 +636,12 @@
             assert evt.fullpath.startswith(self.wprefix)
             wpath = evt.fullpath[len(self.wprefix):]
 
+            # paths have been normalized, wpath never ends with a '/'
+
+            if wpath.startswith('.hg/') and evt.mask & inotify.IN_ISDIR:
+                # ignore subdirectories of .hg/ (merge, patches...)
+                continue
+
             if evt.mask & inotify.IN_UNMOUNT:
                 self.process_unmount(wpath, evt)
             elif evt.mask & (inotify.IN_MODIFY | inotify.IN_ATTRIB):
--- a/tests/test-inotify	Mon Jul 13 16:49:05 2009 +0200
+++ b/tests/test-inotify	Mon Jul 13 21:55:17 2009 +0900
@@ -50,4 +50,24 @@
 hg status
 hg ci -m0
 
+# Test for issue1735: inotify watches files in .hg/merge
+hg st
+
+echo a > a
+
+hg ci -Am a
+hg st
+
+echo b >> a
+hg ci -m ab
+hg st
+
+echo c >> a
+hg st
+
+hg up 0
+hg st
+
+HGMERGE=internal:local hg up
+hg st
 kill `cat hg.pid`
--- a/tests/test-inotify.out	Mon Jul 13 16:49:05 2009 +0200
+++ b/tests/test-inotify.out	Mon Jul 13 21:55:17 2009 +0900
@@ -38,3 +38,9 @@
 removing h/h
 A h
 R h/h
+M a
+merging a
+1 files updated, 1 files merged, 2 files removed, 0 files unresolved
+M a
+3 files updated, 1 files merged, 0 files removed, 0 files unresolved
+M a