annotate tests/test-parseindex @ 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 fb42030d79d6
children 4c94b6d0fb1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2290
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
1 #!/bin/sh
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
2 #
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
3 # revlog.parseindex must be able to parse the index file even if
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
4 # an index entry is split between two 64k blocks. The ideal test
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
5 # would be to create an index file with inline data where
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
6 # 64k < size < 64k + 64 (64k is the size of the read buffer, 64 is
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
7 # the size of an index entry) and with an index entry starting right
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
8 # before the 64k block boundary, and try to read it.
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
9 #
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
10 # We approximate that by reducing the read buffer to 1 byte.
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
11 #
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
12
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
13 hg init a
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
14 cd a
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
15 echo abc > foo
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
16 hg add foo
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
17 hg commit -m 'add foo' -d '1000000 0'
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
18
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
19 echo >> foo
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
20 hg commit -m 'change foo' -d '1000001 0'
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
21 hg log -r 0:
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
22
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
23 cat >> test.py << EOF
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
24 from mercurial import changelog, util
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
25 from mercurial.node import *
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
26
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
27 class singlebyteread(object):
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
28 def __init__(self, real):
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
29 self.real = real
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
30
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
31 def read(self, size=-1):
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
32 if size == 65536:
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
33 size = 1
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
34 return self.real.read(size)
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
35
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
36 def __getattr__(self, key):
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
37 return getattr(self.real, key)
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
38
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
39 def opener(*args):
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
40 o = util.opener(*args)
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
41 def wrapper(*a):
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
42 f = o(*a)
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
43 return singlebyteread(f)
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
44 return wrapper
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
45
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2290
diff changeset
46 cl = changelog.changelog(opener('.hg/store'))
6750
fb42030d79d6 add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents: 3853
diff changeset
47 print len(cl), 'revisions:'
fb42030d79d6 add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents: 3853
diff changeset
48 for r in cl:
2290
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
49 print short(cl.node(r))
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
50 EOF
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
51
6563438219e3 add test for revlog.parseindex
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
52 python test.py