Mercurial > hg
annotate tests/test-convert-hg-source @ 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 | 314fc589b313 |
children | a2f11188e2d2 |
rev | line source |
---|---|
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
1 #!/bin/sh |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
2 |
5556
61fdf2558c0a
convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
5282
diff
changeset
|
3 cat >> $HGRCPATH <<EOF |
61fdf2558c0a
convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
5282
diff
changeset
|
4 [extensions] |
61fdf2558c0a
convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
5282
diff
changeset
|
5 convert= |
61fdf2558c0a
convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
5282
diff
changeset
|
6 [convert] |
61fdf2558c0a
convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
5282
diff
changeset
|
7 hg.saverev=False |
61fdf2558c0a
convert: some tidyups, doc improvements, and test fixes
Bryan O'Sullivan <bos@serpentine.com>
parents:
5282
diff
changeset
|
8 EOF |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
9 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
10 hg init orig |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
11 cd orig |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
12 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
13 echo foo > foo |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
14 echo bar > bar |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
15 hg ci -qAm 'add foo bar' -d '0 0' |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
16 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
17 echo >> foo |
5282
22ddde515fda
test-convert-hg-source: enforce conversion order with --date
Patrick Mezard <pmezard@gmail.com>
parents:
5280
diff
changeset
|
18 hg ci -m 'change foo' -d '1 0' |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
19 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
20 hg up -qC 0 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
21 hg copy --after --force foo bar |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
22 hg copy foo baz |
5282
22ddde515fda
test-convert-hg-source: enforce conversion order with --date
Patrick Mezard <pmezard@gmail.com>
parents:
5280
diff
changeset
|
23 hg ci -m 'make bar and baz copies of foo' -d '2 0' |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
24 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
25 hg merge |
5282
22ddde515fda
test-convert-hg-source: enforce conversion order with --date
Patrick Mezard <pmezard@gmail.com>
parents:
5280
diff
changeset
|
26 hg ci -m 'merge local copy' -d '3 0' |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
27 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
28 hg up -C 1 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
29 hg merge 2 |
5282
22ddde515fda
test-convert-hg-source: enforce conversion order with --date
Patrick Mezard <pmezard@gmail.com>
parents:
5280
diff
changeset
|
30 hg ci -m 'merge remote copy' -d '4 0' |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
31 |
5811
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5556
diff
changeset
|
32 chmod +x baz |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5556
diff
changeset
|
33 hg ci -m 'mark baz executable' -d '5 0' |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5556
diff
changeset
|
34 |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
35 cd .. |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
36 hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
37 cd new |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
38 hg out ../orig |
7231
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
39 cd .. |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
40 |
9528
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
41 echo '% check shamap LF and CRLF handling' |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
42 cat > rewrite.py <<EOF |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
43 import sys |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
44 # Interlace LF and CRLF |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
45 lines = [(l.rstrip() + ((i % 2) and '\n' or '\r\n')) |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
46 for i, l in enumerate(file(sys.argv[1]))] |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
47 file(sys.argv[1], 'wb').write(''.join(lines)) |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
48 EOF |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
49 python rewrite.py new/.hg/shamap |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
50 cd orig |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
51 hg up -qC 1 |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
52 echo foo >> foo |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
53 hg ci -qm 'change foo again' |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
54 hg up -qC 2 |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
55 echo foo >> foo |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
56 hg ci -qm 'change foo again again' |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
57 cd .. |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
58 hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded' |
314fc589b313
convert: make mapfile handle LF and CRLF shamap (issue1846)
Patrick Mezard <pmezard@gmail.com>
parents:
7231
diff
changeset
|
59 |
7231
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
60 echo % init broken repository |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
61 hg init broken |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
62 cd broken |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
63 echo a >> a |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
64 echo b >> b |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
65 hg ci -qAm init |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
66 echo a >> a |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
67 echo b >> b |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
68 hg copy b c |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
69 hg ci -qAm changeall |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
70 hg up -qC 0 |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
71 echo bc >> b |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
72 hg ci -m changebagain |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
73 HGMERGE=internal:local hg -q merge |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
74 hg ci -m merge |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
75 hg mv b d |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
76 hg ci -m moveb |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
77 echo % break it |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
78 rm .hg/store/data/b.* |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
79 cd .. |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
80 |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
81 hg --config convert.hg.ignoreerrors=True convert broken fixed |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
82 hg -R fixed verify |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
83 echo '% manifest -r 0' |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
84 hg -R fixed manifest -r 0 |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
85 echo '% manifest -r tip' |
8e7130a10f3b
convert: ignore hg source errors with hg.ignoreerrors (issue 1357)
Patrick Mezard <pmezard@gmail.com>
parents:
5811
diff
changeset
|
86 hg -R fixed manifest -r tip |
5280
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
87 |
11e1e574da02
convert: mercurial_source: also search for copies in modified files
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
88 true |