annotate tests/test-hgweb-no-path-info @ 11769:ca6cebd8734e stable

dirstate: ignore symlinks when fs cannot handle them (issue1888) When the filesystem cannot handle the executable bit, we currently ignore it completely when looking for modified files. Similarly, it is impossible to set or clear the bit when the filesystem ignores it. This patch makes Mercurial treat symbolic links the same way. Symlinks are a little different since they manifest themselves as small files containing a filename (the symlink target). On Windows, these files show up as regular files, and on Linux and Mac they show up as real symlinks. Issue1888 presents a case where the symlink files are better ignored from the Windows side. A Linux client creates symlinks in a working copy which is shared over a network between Linux and Windows clients. The Samba server is helpful and defererences the symlink when the Windows client looks at it. This means that Mercurial on the Windows side sees file content instead of a file name in the symlink, and hence flags the link as modified. Ignoring the change would be much more helpful, similarly to how Mercurial does not report any changes when executable bits are ignored in a checkout on Windows. An initial checkout of a symbolic link on a file system that cannot handle symbolic links will still result in a regular file containing the target file name as its content. Sharing such a checkout with a Linux client will not turn the file into a symlink automatically, but 'hg revert' can fix that. After the revert, the Windows client will see the correct file content (provided by the Samba server when it follows the link on the Linux side) and otherwise ignore the change. Running 'hg perfstatus' 10 times gives these results: Before: After: min: 0.544703 min: 0.546549 med: 0.547592 med: 0.548881 avg: 0.549146 avg: 0.548549 max: 0.564112 max: 0.551504 The median time is increased about 0.24%.
author Martin Geisler <mg@aragost.com>
date Mon, 09 Aug 2010 15:31:56 +0200
parents 6c82beaaa11a
children dfb11f9922c1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6459
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
1 #!/bin/sh
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
2 # This tests if hgweb and hgwebdir still work if the REQUEST_URI variable is
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
3 # no longer passed with the request. Instead, SCRIPT_NAME and PATH_INFO
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
4 # should be used from d74fc8dec2b4 onward to route the request.
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
5
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
6 mkdir repo
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
7 cd repo
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
8 hg init
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
9 echo foo > bar
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
10 hg add bar
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 6945
diff changeset
11 hg commit -m "test" -u "Testing"
6459
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
12 hg tip
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
13
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
14 cat > request.py <<EOF
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
15 from mercurial.hgweb import hgweb, hgwebdir
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
16 from StringIO import StringIO
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
17 import os, sys
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
18
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
19 errors = StringIO()
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
20 input = StringIO()
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
21
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
22 def startrsp(headers, data):
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
23 print '---- HEADERS'
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
24 print headers
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
25 print '---- DATA'
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
26 print data
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
27 return output.write
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
28
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
29 env = {
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
30 'wsgi.version': (1, 0),
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
31 'wsgi.url_scheme': 'http',
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
32 'wsgi.errors': errors,
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
33 'wsgi.input': input,
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
34 'wsgi.multithread': False,
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
35 'wsgi.multiprocess': False,
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
36 'wsgi.run_once': False,
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
37 'REQUEST_METHOD': 'GET',
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
38 'SCRIPT_NAME': '',
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
39 'SERVER_NAME': '127.0.0.1',
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
40 'SERVER_PORT': os.environ['HGPORT'],
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
41 'SERVER_PROTOCOL': 'HTTP/1.0'
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
42 }
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
43
6945
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
44 def process(app):
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
45 content = app(env, startrsp)
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
46 sys.stdout.write(output.getvalue())
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
47 sys.stdout.write(''.join(content))
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
48 print '---- ERRORS'
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
49 print errors.getvalue()
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
50
6459
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
51 output = StringIO()
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
52 env['QUERY_STRING'] = 'style=atom'
6945
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
53 process(hgweb('.', name='repo'))
6459
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
54
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
55 output = StringIO()
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
56 env['QUERY_STRING'] = 'style=raw'
6945
2cfdabe235fb hgweb: return content iterator instead of using write() callable
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6796
diff changeset
57 process(hgwebdir({'repo': '.'}))
6459
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
58 EOF
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
59
8189e03adb44 hgweb: make hgwebdir work in the absence of PATH_INFO
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
60 python request.py | sed "s/http:\/\/127\.0\.0\.1:[0-9]*\//http:\/\/127.0.0.1\//"