Mercurial > hg
annotate tests/test-convert-svn-move @ 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 | 73a4ed3bfef8 |
children |
rev | line source |
---|---|
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 "$TESTDIR/hghave" svn svn-bindings || exit 80 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 fix_path() |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 { |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 tr '\\' / |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 } |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 echo "[extensions]" >> $HGRCPATH |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 echo "convert = " >> $HGRCPATH |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 echo "hgext.graphlog =" >> $HGRCPATH |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 svnadmin create svn-repo |
7475
90d8dfb481e7
Rewrite svn tests using svndump
Patrick Mezard <pmezard@gmail.com>
parents:
6851
diff
changeset
|
15 cat "$TESTDIR/svn/move.svndump" | svnadmin load svn-repo > /dev/null |
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 svnpath=`pwd | fix_path` |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 # SVN wants all paths to start with a slash. Unfortunately, |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 # Windows ones don't. Handle that. |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
8523
diff
changeset
|
20 expr "$svnpath" : "\/" > /dev/null |
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 if [ $? -ne 0 ]; then |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
8523
diff
changeset
|
22 svnpath="/$svnpath" |
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 fi |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
8523
diff
changeset
|
24 svnurl="file://$svnpath/svn-repo" |
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 echo % convert trunk and branches |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
8523
diff
changeset
|
27 hg convert --datesort "$svnurl"/subproject A-hg |
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 cd A-hg |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
7475
diff
changeset
|
30 hg glog --template '{rev} {desc|firstline} files: {files}\n' |
11124
55abde5cba43
test-convert-svn-move: test moved dirs copy records
Patrick Mezard <pmezard@gmail.com>
parents:
10775
diff
changeset
|
31 echo '% check move copy records' |
55abde5cba43
test-convert-svn-move: test moved dirs copy records
Patrick Mezard <pmezard@gmail.com>
parents:
10775
diff
changeset
|
32 hg st --rev 12:13 --copies |
55abde5cba43
test-convert-svn-move: test moved dirs copy records
Patrick Mezard <pmezard@gmail.com>
parents:
10775
diff
changeset
|
33 echo '% check branches' |
5955
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 hg branches | sed 's/:.*/:/' |
c4496b7c10ce
convert: fix svn_source.latest()
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 cd .. |
11128
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
36 |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
37 mkdir test-replace |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
38 cd test-replace |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
39 svnadmin create svn-repo |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
40 cat "$TESTDIR/svn/replace.svndump" | svnadmin load svn-repo > /dev/null |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
41 |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
42 echo '% convert files being replaced by directories' |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
43 hg convert svn-repo hg-repo |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
44 cd hg-repo |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
45 echo '% manifest before' |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
46 hg -v manifest -r 1 |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
47 echo '% manifest after clobber1' |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
48 hg -v manifest -r 2 |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
49 echo '% manifest after clobber2' |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
50 hg -v manifest -r 3 |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
51 echo '% try updating' |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
52 hg up -qC default |
a9b427b5821e
convert/svn: handle files/links replaced by dirs (issue2166)
Patrick Mezard <pmezard@gmail.com>
parents:
11124
diff
changeset
|
53 cd .. |
11135
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
54 |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
55 echo '% test convert progress bar' |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
56 |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
57 echo "progress=" >> $HGRCPATH |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
58 echo "[progress]" >> $HGRCPATH |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
59 echo "assume-tty=1" >> $HGRCPATH |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
60 echo "delay=0" >> $HGRCPATH |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
61 echo "refresh=0" >> $HGRCPATH |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
62 |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
63 cat > filtercr.py <<EOF |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
64 import sys, re |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
65 for line in sys.stdin: |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
66 line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line) |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
67 sys.stdout.write(line) |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
68 EOF |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
69 |
73a4ed3bfef8
convert: add progress support
Patrick Mezard <pmezard@gmail.com>
parents:
11128
diff
changeset
|
70 hg convert svn-repo hg-progress 2>&1 | python filtercr.py |