merge with stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 20 Nov 2009 02:34:56 +0100
changeset 9898 b5170b8b32a5
parent 9895 30a2aa8e5290 (current diff)
parent 9897 97eda2133a9b (diff)
child 9901 cb2a1836c50a
child 9906 0ebef7e813df
merge with stable
--- a/hgext/inotify/server.py	Thu Nov 19 23:39:30 2009 +0100
+++ b/hgext/inotify/server.py	Fri Nov 20 02:34:56 2009 +0100
@@ -849,9 +849,14 @@
             finally:
                 self.master.shutdown()
 
-    runargs = None
     if 'inserve' not in sys.argv:
         runargs = [sys.argv[0], 'inserve', '-R', root]
+    else:
+        runargs = sys.argv[:]
+
+    pidfile = ui.config('inotify', 'pidfile')
+    if opts['daemon'] and pidfile is not None and 'pid-file' not in runargs:
+        runargs.append("--pid-file=%s" % pidfile)
 
     service = service()
     logfile = ui.config('inotify', 'log')
--- a/mercurial/cmdutil.py	Thu Nov 19 23:39:30 2009 +0100
+++ b/mercurial/cmdutil.py	Fri Nov 20 02:34:56 2009 +0100
@@ -571,7 +571,7 @@
         if parentfn:
             return parentfn(pid)
         else:
-            os._exit(0)
+            return
 
     if initfn:
         initfn()
--- a/tests/test-inotify	Thu Nov 19 23:39:30 2009 +0100
+++ b/tests/test-inotify	Fri Nov 20 02:34:56 2009 +0100
@@ -2,7 +2,8 @@
 
 "$TESTDIR/hghave" inotify || exit 80
 
-hg init
+hg init repo1
+cd repo1
 
 touch a b c d e
 mkdir dir
@@ -10,10 +11,22 @@
 touch dir/x dir/y dir/bar/foo
 
 hg ci -Am m
+cd ..
+hg clone repo1 repo2
 
 echo "[extensions]" >> $HGRCPATH
 echo "inotify=" >> $HGRCPATH
 
+cd repo2
+echo b >> a
+# check that daemon started automatically works correctly
+# and make sure that inotify.pidfile works
+hg --config "inotify.pidfile=../hg2.pid" status
+
+# make sure that pidfile worked. Output should be silent.
+kill `cat ../hg2.pid`
+
+cd ../repo1
 echo % inserve
 hg inserve -d --pid-file=hg.pid
 cat hg.pid >> "$DAEMON_PIDS"
--- a/tests/test-inotify-dirty-dirstate	Thu Nov 19 23:39:30 2009 +0100
+++ b/tests/test-inotify-dirty-dirstate	Fri Nov 20 02:34:56 2009 +0100
@@ -20,10 +20,10 @@
 
 cd ..
 
-hg --config "extensions.inotify=!" clone test test2
+hg --config "inotify.pidfile=../hg2.pid" clone test test2
+cat ../hg2.pid >> "$DAEMON_PIDS"
+
 cd test2
-hg inserve -d --pid-file=../hg2.pid
-cat ../hg2.pid >> "$DAEMON_PIDS"
 echo bar > bar
 hg add
 hg ci -m bar
--- a/tests/test-inotify-issue1208.out	Thu Nov 19 23:39:30 2009 +0100
+++ b/tests/test-inotify-issue1208.out	Fri Nov 20 02:34:56 2009 +0100
@@ -1,5 +1,6 @@
 % fail
 abort: could not start server: File exists
+could not talk to new inotify server: No such file or directory
 abort: could not start server: File exists
 % inserve
 % status
--- a/tests/test-inotify.out	Thu Nov 19 23:39:30 2009 +0100
+++ b/tests/test-inotify.out	Fri Nov 20 02:34:56 2009 +0100
@@ -6,6 +6,9 @@
 adding dir/x
 adding dir/y
 adding e
+updating to branch default
+8 files updated, 0 files merged, 0 files removed, 0 files unresolved
+M a
 % inserve
 ? hg.pid
 % clean