annotate tests/test-encode @ 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 1c4ab236ebcb
children 4c94b6d0fb1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
1 #!/bin/sh
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
2
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
3 hg init
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
4
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
5 cat > .hg/hgrc <<EOF
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
6 [encode]
10279
1c4ab236ebcb test-encode: Use tr chacter classes instead of character ranges
Mads Kiilerich <mads@kiilerich.com>
parents: 10211
diff changeset
7 not.gz = tr [:lower:] [:upper:]
7080
a6477aa893b8 tests: Windows compatibility fixes
Patrick Mezard <pmezard@gmail.com>
parents: 6094
diff changeset
8 *.gz = gzip -d
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
9
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
10 [decode]
10279
1c4ab236ebcb test-encode: Use tr chacter classes instead of character ranges
Mads Kiilerich <mads@kiilerich.com>
parents: 10211
diff changeset
11 not.gz = tr [:upper:] [:lower:]
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
12 *.gz = gzip
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
13
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
14 EOF
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
15
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
16 echo "this is a test" | gzip > a.gz
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
17 echo "this is a test" > not.gz
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
18 hg add *
1933
7544700fd931 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1258
diff changeset
19 hg ci -m "test" -d "1000000 0"
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
20 echo %% no changes
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
21 hg status
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
22 touch *
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
23
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
24 echo %% no changes
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
25 hg status
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
26
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
27 echo %% check contents in repo are encoded
3853
c0b449154a90 switch to the .hg/store layout, fix the tests
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1933
diff changeset
28 hg debugdata .hg/store/data/a.gz.d 0
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
29 hg debugdata .hg/store/data/not.gz.d 0
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
30
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
31 echo %% check committed content was decoded
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
32 gunzip < a.gz
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
33 cat not.gz
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
34
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
35 rm *
8742
a964ab624385 merge: allow merging going backwards
Matt Mackall <mpm@selenic.com>
parents: 7080
diff changeset
36 hg co -C
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
37
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
38 echo %% check decoding of our new working dir copy
1258
1945754e466b Add file encoding/decoding support
mpm@selenic.com
parents:
diff changeset
39 gunzip < a.gz
10211
a474f950357b Update test and man page for multiple matching encode/decode filters
Mads Kiilerich <mads@kiilerich.com>
parents: 8742
diff changeset
40 cat not.gz
6093
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
41
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
42 echo %% check hg cat operation
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
43 hg cat a.gz
6094
3998c1b0828f cat --decode: Drop short option, use opts.get() instead of opts[]
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6093
diff changeset
44 hg cat --decode a.gz | gunzip
6093
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
45 mkdir subdir
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
46 cd subdir
f5b00b6e426a Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents: 3853
diff changeset
47 hg -R .. cat ../a.gz
6094
3998c1b0828f cat --decode: Drop short option, use opts.get() instead of opts[]
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6093
diff changeset
48 hg -R .. cat --decode ../a.gz | gunzip