# HG changeset patch # User Benoit Boissinot # Date 1258680896 -3600 # Node ID b5170b8b32a5a8a77a9062da5726c0e4a667410d # Parent 30a2aa8e529055d3f182f54cb2a9ac0a72c32b76# Parent 97eda2133a9bd2a1f2cafd572e18d6c8053e19dd merge with stable diff -r 30a2aa8e5290 -r b5170b8b32a5 hgext/inotify/server.py --- 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') diff -r 30a2aa8e5290 -r b5170b8b32a5 mercurial/cmdutil.py --- 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() diff -r 30a2aa8e5290 -r b5170b8b32a5 tests/test-inotify --- 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" diff -r 30a2aa8e5290 -r b5170b8b32a5 tests/test-inotify-dirty-dirstate --- 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 diff -r 30a2aa8e5290 -r b5170b8b32a5 tests/test-inotify-issue1208.out --- 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 diff -r 30a2aa8e5290 -r b5170b8b32a5 tests/test-inotify.out --- 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