comparison tests/test-symlink-os-yes-fs-no.py @ 30448:8836f13e3c5b

posix: give checklink a fast path that cache the check file and is read only util.checklink would create a symlink and remove it again. That would sometimes happen multiple times. Write operations are relatively expensive and give disk tear and noise for applications monitoring file system activity. Instead of creating a symlink and deleting it again, just create it once and leave it in .hg/cache/check-link . If the file exists, just verify that os.islink reports true. We will assume that this check is as good as symlink creation not failing. Note: The symlink left in .hg/cache has to resolve to a file - otherwise 'make dist' will fail ... test-symlink-os-yes-fs-no.py does some monkey patching to simulate a platform without symlink support. The slightly different testing method requires additional monkeying.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 14 Jan 2015 01:15:26 +0100
parents 3b453513f1fe
children d83ca854fa21
comparison
equal deleted inserted replaced
30447:0d87b1caed92 30448:8836f13e3c5b
33 # now disable symlink support -- this is what os.symlink would do on a 33 # now disable symlink support -- this is what os.symlink would do on a
34 # non-symlink file system 34 # non-symlink file system
35 def symlink_failure(src, dst): 35 def symlink_failure(src, dst):
36 raise OSError(1, "Operation not permitted") 36 raise OSError(1, "Operation not permitted")
37 os.symlink = symlink_failure 37 os.symlink = symlink_failure
38 def islink_failure(path):
39 return False
40 os.path.islink = islink_failure
38 41
39 # dereference links as if a Samba server has exported this to a 42 # dereference links as if a Samba server has exported this to a
40 # Windows client 43 # Windows client
41 for f in 'test0/a.lnk', 'test0/d/b.lnk': 44 for f in 'test0/a.lnk', 'test0/d/b.lnk':
42 os.unlink(f) 45 os.unlink(f)