diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -197,7 +197,7 @@ def create_server(ui, repo): def openlog(opt, default): if opt and opt != '-': - return open(opt, 'w') + return open(opt, 'a') return default if repo is None: diff --git a/tests/test-hgweb b/tests/test-hgweb --- a/tests/test-hgweb +++ b/tests/test-hgweb @@ -7,7 +7,7 @@ mkdir da echo foo > da/foo echo foo > foo hg ci -Ambase -d '0 0' -hg serve -p $HGPORT -d --pid-file=hg.pid +hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log cat hg.pid >> $DAEMON_PIDS echo % manifest ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw') @@ -28,5 +28,12 @@ echo % should give a 400 - bad command echo % should give a 404 - file does not exist "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw' +echo % stop and restart +kill `cat hg.pid` +hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log +cat hg.pid >> $DAEMON_PIDS +# Test the access/error files are opened in append mode +python -c "print len(file('access.log').readlines()), 'log lines written'" + echo % static file "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css' diff --git a/tests/test-hgweb.out b/tests/test-hgweb.out --- a/tests/test-hgweb.out +++ b/tests/test-hgweb.out @@ -65,6 +65,8 @@ 404 Not Found error: Path not found: bork/ +% stop and restart +7 log lines written % static file 200 Script output follows