[PATCH 2 of 2] Fix for inotify patch(issue 1375) and a test case

Gerard Korsten soonkia77 at gmail.com
Fri Nov 7 21:26:26 CST 2008


# HG changeset patch
# User Gerard Korsten <soonkia77 at gmail.com>
# Date 1226113313 -7200
# Node ID cd6698d02f3c906b1ca804c221e765abb7199514
# Parent  1a2bb72ed51177b62d6fb9ee6162f995723406c3
Fix for inotify patch(issue 1375) and a test case

diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py
--- a/hgext/inotify/__init__.py
+++ b/hgext/inotify/__init__.py
@@ -54,11 +54,12 @@
             files = match.files()
             try:
                 if not ignored and not self.inotifyserver:
-                    result = client.query(ui, repo, files, match, False,
-                                          clean, unknown)
+                    r2 = super(inotifydirstate, self).status(
+                            match, False, clean, unknown)
                     if ui.config('inotify', 'debug'):
-                        r2 = super(inotifydirstate, self).status(
-                            match, False, clean, unknown)
+                        result = client.query(ui, repo, files, match, False,
+                            clean, unknown)
+
                         for c,a,b in zip('LMARDUIC', result, r2):
                             for f in a:
                                 if f not in b:
@@ -66,8 +67,7 @@
                             for f in b:
                                 if f not in a:
                                     ui.warn('*** inotify: %s -%s\n' % (c, f))
-                        result = r2
-
+                    result = r2
                     if result is not None:
                         return result
             except (OSError, socket.error), err:
diff --git a/tests/test-inotify b/tests/test-inotify
--- a/tests/test-inotify
+++ b/tests/test-inotify
@@ -27,4 +27,18 @@
 echo % all
 hg status -A
 
+#issue 1375
+#Testing that we can remove a folder and then add a file with the same name
+
+mkdir h 
+echo h > h/h
+hg ci -Am t
+hg rm h
+sleep 1
+echo h >h
+hg add h
+sleep 1
+hg status
+hg ci -m0
 kill `cat hg.pid`
+
diff --git a/tests/test-inotify-issue1371 b/tests/test-inotify-issue1371
--- a/tests/test-inotify-issue1371
+++ b/tests/test-inotify-issue1371
@@ -27,6 +27,7 @@
 touch g
 hg add g
 hg mv e h
+sleep 1
 hg status
 
 sleep 1
diff --git a/tests/test-inotify.out b/tests/test-inotify.out
--- a/tests/test-inotify.out
+++ b/tests/test-inotify.out
@@ -27,3 +27,8 @@
 C dir/x
 C dir/y
 C e
+adding h/h
+adding hg.pid
+removing h/h
+A h
+R h/h


More information about the Mercurial-devel mailing list