Mercurial > hg
annotate tests/test-subrepo-svn @ 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 | 0bf79efeaa20 |
children |
rev | line source |
---|---|
10178 | 1 #!/bin/sh |
2 | |
3 "$TESTDIR/hghave" svn || exit 80 | |
4 | |
10198
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
5 fix_path() |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
6 { |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
7 tr '\\' / |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
8 } |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
9 |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
10 escapedwd=`pwd | fix_path` |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
11 # SVN wants all paths to start with a slash. Unfortunately, |
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
12 # Windows ones don't. Handle that. |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
13 expr "$escapedwd" : "\/" > /dev/null |
10198
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
14 if [ $? -ne 0 ]; then |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
15 escapedwd="/$escapedwd" |
10198
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
16 fi |
10791
48c8eb9de0c8
test-subrepo-svn: properly escape the url, make it work for svn 1.5 again
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10775
diff
changeset
|
17 escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"` |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
18 filterpath="s|$escapedwd|/root|" |
10954
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
19 filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /' |
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
20 filterexternal="s|Fetching external item into '.*/s/externals'|Fetching external item into 's/externals'|g" |
10178 | 21 |
22 echo % create subversion repo | |
23 | |
24 SVNREPO="file://$escapedwd/svn-repo" | |
10267
7e3a685be2f3
test-subrepo-svn: remove bashism
Mads Kiilerich <mads@kiilerich.com>
parents:
10198
diff
changeset
|
25 WCROOT="`pwd`/svn-wc" |
10178 | 26 svnadmin create svn-repo |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
27 svn co "$SVNREPO" svn-wc |
10178 | 28 cd svn-wc |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
29 mkdir src |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
30 echo alpha > src/alpha |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
31 svn add src |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
32 mkdir externals |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
33 echo other > externals/other |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
34 svn add externals |
10178 | 35 svn ci -m 'Add alpha' |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
36 svn up |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
37 cat > extdef <<EOF |
10791
48c8eb9de0c8
test-subrepo-svn: properly escape the url, make it work for svn 1.5 again
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10775
diff
changeset
|
38 externals -r1 $SVNREPO/externals |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
39 EOF |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
40 svn propset -F extdef svn:externals src |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
41 svn ci -m 'Setting externals' |
10178 | 42 cd .. |
43 | |
44 echo % create hg repo | |
45 mkdir sub | |
46 cd sub | |
47 hg init t | |
48 cd t | |
49 | |
50 echo % first revision, no sub | |
51 echo a > a | |
52 hg ci -Am0 | |
53 | |
10457
4f38d03d4975
subrepo: make sure that the source path is stripped
David Soria Parra <dsp@php.net>
parents:
10423
diff
changeset
|
54 echo % add first svn sub with leading whitespaces |
4f38d03d4975
subrepo: make sure that the source path is stripped
David Soria Parra <dsp@php.net>
parents:
10423
diff
changeset
|
55 echo "s = [svn] $SVNREPO/src" >> .hgsub |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
56 svn co --quiet "$SVNREPO"/src s |
10178 | 57 hg add .hgsub |
58 hg ci -m1 | |
59 echo % debugsub | |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
60 hg debugsub | sed "$filterpath" |
10178 | 61 |
62 echo | |
63 echo % change file in svn and hg, commit | |
64 echo a >> a | |
65 echo alpha >> s/alpha | |
11142
0bf79efeaa20
test-subrepo-svn: fix strange svn behaviour on windows
Patrick Mezard <pmezard@gmail.com>
parents:
10954
diff
changeset
|
66 hg commit -m 'Message!' | sed "$filterexternal" \ |
0bf79efeaa20
test-subrepo-svn: fix strange svn behaviour on windows
Patrick Mezard <pmezard@gmail.com>
parents:
10954
diff
changeset
|
67 | sed 's:Sending.*s/alpha:Sending s/alpha:g' |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
68 hg debugsub | sed "$filterpath" |
10178 | 69 |
70 echo | |
71 echo a > s/a | |
72 echo % should be empty despite change to s/a | |
73 hg st | |
74 | |
75 echo | |
76 echo % add a commit from svn | |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
77 cd "$WCROOT"/src |
10178 | 78 svn up |
79 echo xyz >> alpha | |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
80 svn propset svn:mime-type 'text/xml' alpha |
10178 | 81 svn ci -m 'amend a from svn' |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
82 cd ../../sub/t |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
83 |
10178 | 84 echo % this commit from hg will fail |
85 echo zzz >> s/alpha | |
10954
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
86 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
87 svn revert -q s/alpha |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
88 |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
89 echo % this commit fails because of meta changes |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
90 svn propset svn:mime-type 'text/html' s/alpha |
10954
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
91 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate" |
10273
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
92 svn revert -q s/alpha |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
93 |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
94 echo % this commit fails because of externals changes |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
95 echo zzz > s/externals/other |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
96 hg ci -m 'amend externals from hg' |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
97 svn revert -q s/externals/other |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
98 |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
99 echo % this commit fails because of externals meta changes |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
100 svn propset svn:mime-type 'text/html' s/externals/other |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
101 hg ci -m 'amend externals from hg' |
e898bc7810ad
subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents:
10267
diff
changeset
|
102 svn revert -q s/externals/other |
10178 | 103 |
104 echo | |
105 echo % clone | |
106 cd .. | |
10198
c2168d170f05
test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents:
10196
diff
changeset
|
107 hg clone t tc | fix_path |
10178 | 108 cd tc |
109 echo % debugsub in clone | |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10457
diff
changeset
|
110 hg debugsub | sed "$filterpath" |
10954
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
111 |
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
112 echo % verify subrepo is contained within the repo directory |
33119d0252c1
subrepo: fix repo root path handling in svn subrepo
Brett Cannon <brett@python.org>
parents:
10791
diff
changeset
|
113 python -c "import os.path; print os.path.exists('s')" |