Mercurial > hg
annotate tests/test-diff-ignore-whitespace @ 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 |
rev | line source |
---|---|
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
3 # GNU diff is the reference for all of these results. |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
4 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
5 hgdiff() { |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
6 echo hg diff $@ |
3199
096f1c73cdc3
Add -D/--nodates options to hg diff/export that removes dates from diff headers
Stephen Darnell <stephen@darnell.plus.com>
parents:
2610
diff
changeset
|
7 hg diff --nodates "$@" |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
8 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
9 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
10 test_added_blank_lines() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
11 printf '\nhello world\n\ngoodbye world\n\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
12 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
13 echo '>>> two diffs showing three added lines <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
14 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
16 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
17 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
18 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
19 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
20 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
21 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
22 test_added_horizontal_space_first_on_a_line() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
23 printf '\t hello world\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
24 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 echo '>>> four diffs showing added space first on the first line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
26 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
27 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
28 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
29 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
30 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
31 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
32 test_added_horizontal_space_last_on_a_line() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
33 printf 'hello world\t \ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
34 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
35 echo '>>> two diffs showing space appended to the first line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
36 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
37 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
38 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
39 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
40 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
41 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
42 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
43 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
44 test_added_horizontal_space_in_the_middle_of_a_word() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
45 printf 'hello world\ngood bye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
46 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
47 echo '>>> four diffs showing space inserted into "goodbye" <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
48 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
49 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
50 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
51 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
52 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
53 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
54 test_increased_horizontal_whitespace_amount() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
55 printf 'hello world\ngoodbye\t\t \tworld\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
56 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
57 echo '>>> two diffs showing changed whitespace amount in the last line <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
58 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
59 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
60 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
61 echo '>>> no diffs <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
62 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
63 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
64 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
65 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
66 test_added_blank_line_with_horizontal_whitespace() { |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
67 printf 'hello world\n \t\ngoodbye world\n' >foo |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
68 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
69 echo '>>> four diffs showing added blank line w/horizontal space <<<' |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
70 hgdiff |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
71 hgdiff -B |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
72 hgdiff -b |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
73 hgdiff -Bb |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
74 } |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
75 |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
76 test_added_blank_line_with_other_whitespace() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
77 printf 'hello world\n \t\ngoodbye world \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
78 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
79 echo '>>> three diffs showing added blank line w/other space <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
80 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
81 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
82 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
83 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
84 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
85 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
86 test_whitespace_changes() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
87 printf 'helloworld\ngoodbye\tworld \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
88 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
89 echo '>>> four diffs showing changed whitespace <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
90 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
91 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
92 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
93 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
94 hgdiff -w |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
95 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
96 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
97 test_whitespace_changes_and_blank_lines() { |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
98 printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
99 |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
100 echo '>>> five diffs showing changed whitespace <<<' |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
101 hgdiff |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
102 hgdiff -B |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
103 hgdiff -b |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
104 hgdiff -Bb |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
105 hgdiff -w |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
106 hgdiff -wB |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
107 } |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
108 |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
109 hg init |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
110 printf 'hello world\ngoodbye world\n' >foo |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
4878
diff
changeset
|
111 hg ci -Amfoo -ufoo |
2594
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
112 |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
113 test_added_blank_lines |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
114 test_added_horizontal_space_first_on_a_line |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
115 test_added_horizontal_space_last_on_a_line |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
116 test_added_horizontal_space_in_the_middle_of_a_word |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
117 test_increased_horizontal_whitespace_amount |
bdf9d809467c
add missed tests for diff -b/-B
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
118 test_added_blank_line_with_horizontal_whitespace |
4878
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
119 test_added_blank_line_with_other_whitespace |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
120 test_whitespace_changes |
372d93f03d3a
diff: correctly handle combinations of whitespace options
Matt Mackall <mpm@selenic.com>
parents:
3199
diff
changeset
|
121 test_whitespace_changes_and_blank_lines |