Commits

Anonymous committed 035d5fa

some work

Comments (0)

Files changed (5)

+# HG changeset patch
+# User Nicolas Dumazet <nicdumz.commits@gmail.com>
+# Date 1257917939 -32400
+# Node ID 3e877c909d2d25cc806819d015b80179aeb65b7a
+# Parent  0d850f8beea68e7c6f7f312148546900cfc58898
+inotify: Do not access inotify when dirstate is dirty (issue1811)
+
+Original patch was provided by Simon Heimberg
+
+It delegates dirstate computation to dirstate.status when dirstate is dirty:
+better be slow from time to time instead of using wrong data.
+
+diff --git a/hgext/inotify/__init__.py b/hgext/inotify/__init__.py
+--- a/hgext/inotify/__init__.py
++++ b/hgext/inotify/__init__.py
+@@ -46,7 +46,7 @@
+             files = match.files()
+             if '.' in files:
+                 files = []
+-            if self._inotifyon and not ignored:
++            if self._inotifyon and not ignored and not self._dirty:
+                 cli = client(ui, repo)
+                 try:
+                     result = cli.statusquery(files, match, False,
+diff --git a/tests/test-inotify-dirty-dirstate b/tests/test-inotify-dirty-dirstate
+new file mode 100755
+--- /dev/null
++++ b/tests/test-inotify-dirty-dirstate
+@@ -0,0 +1,67 @@
++#!/bin/sh
++
++# issues when status queries are issued when dirstate is dirty
++
++"$TESTDIR/hghave" inotify || exit 80
++
++echo "[extensions]" >> $HGRCPATH
++echo "inotify=" >> $HGRCPATH
++echo "fetch=" >> $HGRCPATH
++
++echo % issue1801: inotify and fetch
++mkdir test; cd test
++hg init
++
++echo foo > foo
++hg add
++hg ci -m foo
++
++cd ..
++
++hg clone test test2
++cd test2
++echo bar > bar
++hg add
++hg ci -m bar
++cd ../test
++echo spam > spam
++hg add
++hg ci -m spam
++cd ../test2
++hg st
++
++# abort, outstanding changes
++hg fetch -q
++hg st
++cd ..
++
++
++echo % issue1719: inotify and mq
++
++echo "mq=" >> $HGRCPATH
++
++hg init test-1719
++cd test-1719
++
++echo % inserve
++hg inserve -d --pid-file=hg.pid
++cat hg.pid >> "$DAEMON_PIDS"
++
++echo content > file
++hg add file
++
++hg qnew -f test.patch
++
++hg status
++hg qpop
++
++echo % st should not output anything
++hg status
++
++hg qpush
++
++echo % st should not output anything
++hg status
++
++hg qrefresh
++hg status
+diff --git a/tests/test-inotify-dirty-dirstate.out b/tests/test-inotify-dirty-dirstate.out
+new file mode 100644
+--- /dev/null
++++ b/tests/test-inotify-dirty-dirstate.out
+@@ -0,0 +1,18 @@
++% issue1801: inotify and fetch
++adding foo
++updating working directory
++1 files updated, 0 files merged, 0 files removed, 0 files unresolved
++adding bar
++adding spam
++% issue1719: inotify and mq
++% inserve
++? hg.pid
++popping test.patch
++patch queue now empty
++% st should not output anything
++? hg.pid
++applying test.patch
++now at: test.patch
++% st should not output anything
++? hg.pid
++? hg.pid
 diff --git a/setup.py b/setup.py
 --- a/setup.py
 +++ b/setup.py
-@@ -244,6 +244,15 @@
+@@ -252,6 +252,15 @@
          ext_modules.append(Extension('hgext.inotify.linux._inotify',
                                       ['hgext/inotify/linux/_inotify.c']))
          packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
 +    packages.append('hgext.inotify')
  
  datafiles = []
- for root in ('templates', 'i18n'):
+ for root in ('templates', 'i18n', 'help'):
-tmpdir
+dirty-dirstate
+tmppp
 pyfs
 separate
 activate-inot-mac

tmpdir

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1250338797 -32400
-
-run-tests: expand --tmpdir and create it if needed
-
-diff --git a/tests/run-tests.py b/tests/run-tests.py
---- a/tests/run-tests.py
-+++ b/tests/run-tests.py
-@@ -167,6 +167,14 @@
-     else:
-         vlog = lambda *msg: None
- 
-+    if options.tmpdir:
-+        options.tmpdir = os.path.expanduser(options.tmpdir)
-+        try:
-+            os.makedirs(options.tmpdir)
-+        except OSError, err:
-+            if err.errno != errno.EEXIST:
-+                raise
-+
-     if options.jobs < 1:
-         print >> sys.stderr, 'ERROR: -j/--jobs must be positive'
-         sys.exit(1)
+diff --git a/tests/test-inotify-dirty-dirstate b/tests/test-inotify-dirty-dirstate
+--- a/tests/test-inotify-dirty-dirstate
++++ b/tests/test-inotify-dirty-dirstate
+@@ -8,24 +8,31 @@
+ echo "inotify=" >> $HGRCPATH
+ echo "fetch=" >> $HGRCPATH
+ 
+-echo % issue1801: inotify and fetch
++echo % issue1810: inotify and fetch
+ mkdir test; cd test
+ hg init
+ 
++echo % first inserve
++hg inserve -d --pid-file=hg.pid
++cat hg.pid >> "$DAEMON_PIDS"
++
+ echo foo > foo
+-hg add
++hg add foo
++hg heads
+ hg ci -m foo
+ 
+ cd ..
+ 
+ hg clone test test2
+ cd test2
++# inotify daemon is already running here due to the clone
++
+ echo bar > bar
+-hg add
++hg add bar
+ hg ci -m bar
+ cd ../test
+ echo spam > spam
+-hg add
++hg add spam
+ hg ci -m spam
+ cd ../test2
+ hg st
+@@ -34,6 +41,7 @@
+ hg fetch -q
+ hg st
+ cd ..
++kill `cat test/hg.pid`
+ 
+ 
+ echo % issue1719: inotify and mq
+@@ -65,3 +73,5 @@
+ 
+ hg qrefresh
+ hg status
++
++kill `cat hg.pid`