annotate tests/test-convert-p4 @ 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 d4d4da54ab05
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
1 #!/bin/sh
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
2
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
3 "$TESTDIR/hghave" p4 || exit 80
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
4
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
5 echo "[extensions]" >> $HGRCPATH
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
6 echo "convert = " >> $HGRCPATH
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
7
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
8 echo % create p4 depot
9044
d4d4da54ab05 Bourne shells do not maintain $PWD; update tests accordingly
David Champion <dgc@uchicago.edu>
parents: 9043
diff changeset
9 P4ROOT=`pwd`/depot; export P4ROOT
9043
438f0b1d4684 tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents: 8523
diff changeset
10 P4AUDIT=$P4ROOT/audit; export P4AUDIT
438f0b1d4684 tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents: 8523
diff changeset
11 P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
438f0b1d4684 tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents: 8523
diff changeset
12 P4LOG=$P4ROOT/log; export P4LOG
438f0b1d4684 tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents: 8523
diff changeset
13 P4PORT=localhost:16661; export P4PORT
438f0b1d4684 tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents: 8523
diff changeset
14 P4DEBUG=1; export P4DEBUG
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
15
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
16 echo % start the p4 server
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
17 [ ! -d $P4ROOT ] && mkdir $P4ROOT
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
18 p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
19 trap "echo % stop the p4 server ; p4 admin stop" EXIT
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
20
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
21 # wait for the server to initialize
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
22 while ! p4 ; do
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
23 sleep 1
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
24 done >/dev/null 2>/dev/null
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
25
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
26 echo % create a client spec
9043
438f0b1d4684 tests: remove more instances of export FOO=bar bashism
Brodie Rao <me+hg@dackz.net>
parents: 8523
diff changeset
27 P4CLIENT=hg-p4-import; export P4CLIENT
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
28 DEPOTPATH=//depot/test-mercurial-import/...
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
29 p4 client -o | sed '/^View:/,$ d' >p4client
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
30 echo View: >>p4client
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
31 echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
32 p4 client -i <p4client
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
33
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
34 echo % populate the depot
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
35 echo a > a
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
36 mkdir b
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
37 echo c > b/c
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
38 p4 add a b/c
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
39 p4 submit -d initial
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
40
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
41 echo % change some files
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
42 p4 edit a
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
43 echo aa >> a
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
44 p4 submit -d "change a"
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
45
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
46 p4 edit b/c
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
47 echo cc >> b/c
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
48 p4 submit -d "change b/c"
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
49
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
50 echo % convert
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
51 hg convert -s p4 $DEPOTPATH dst
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8063
diff changeset
52 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
53
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
54 echo % change some files
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
55 p4 edit a b/c
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
56 echo aaa >> a
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
57 echo ccc >> b/c
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
58 p4 submit -d "change a b/c"
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
59
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
60 echo % convert again
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
61 hg convert -s p4 $DEPOTPATH dst
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8063
diff changeset
62 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
63
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
64 echo % interesting names
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
65 echo dddd > "d d"
8063
ee8d9b93b316 convert/p4: win32 fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
66 mkdir " e"
ee8d9b93b316 convert/p4: win32 fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
67 echo fff >" e/ f"
ee8d9b93b316 convert/p4: win32 fixes
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
68 p4 add "d d" " e/ f"
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
69 p4 submit -d "add d e f"
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
70
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
71 echo % convert again
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
72 hg convert -s p4 $DEPOTPATH dst
8523
5b7da468531b tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents: 8063
diff changeset
73 hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
74
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff changeset
75