annotate tests/test-hgignore @ 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 31abcae33b4f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
1 #!/bin/sh
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
2
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
3 hg init
4439
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
4
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
5 # Test issue 562: .hgignore requires newline at end
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
6 touch foo
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
7 touch bar
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
8 touch baz
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
9 cat > makeignore.py <<EOF
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
10 f = open(".hgignore", "w")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
11 f.write("ignore\n")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
12 f.write("foo\n")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
13 # No EOL here
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
14 f.write("bar")
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
15 f.close()
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
16 EOF
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
17
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
18 python makeignore.py
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
19 echo % should display baz only
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
20 hg status
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
21 rm foo bar baz .hgignore makeignore.py
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
22
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
23 touch a.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
24 touch a.c
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
25 touch syntax
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
26 mkdir dir
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
27 touch dir/a.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
28 touch dir/b.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
29 touch dir/c.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
30
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
31 hg add dir/a.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
32 hg commit -m 0
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
33 hg add dir/b.o
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
34
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
35 echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
36
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
37 echo "*.o" > .hgignore
2009
182f500805db Fix broken hgignore tests due to full path showing up in output.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1568
diff changeset
38 echo "--" ; hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/'
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
39
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
40 echo ".*\.o" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
41 echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
42
6479
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
43 # Check it does not ignore the current directory '.'
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
44 echo "^\." > .hgignore
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
45 echo "--" ; hg status
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
46
5029
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
47 echo "glob:**.o" > .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
48 echo "--" ; hg status
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
49
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
50 echo "glob:*.o" > .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
51 echo "--" ; hg status
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
52
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
53 echo "syntax: glob" > .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
54 echo "re:.*\.o" >> .hgignore
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
55 echo "--" ; hg status
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
56
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
57 echo "syntax: invalid" > .hgignore
2009
182f500805db Fix broken hgignore tests due to full path showing up in output.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1568
diff changeset
58 echo "--" ; hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
59
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
60 echo "syntax: glob" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
61 echo "*.o" >> .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
62 echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
63
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
64 echo "relglob:syntax*" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
65 echo "--" ; hg status
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
66
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
67 echo "relglob:*" > .hgignore
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
68 echo "--" ; hg status
1491
91c0e8d7ddcf fix a bug in dirstate.changes when cwd != repo.root
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1478
diff changeset
69
91c0e8d7ddcf fix a bug in dirstate.changes when cwd != repo.root
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1478
diff changeset
70 cd dir
1568
1d7d0c07e8f3 make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1491
diff changeset
71 echo "--" ; hg status .