annotate tests/test-subrepo-svn @ 10775:c52057614c72 stable

Tests with spaces in paths This allows most tests to succeed with ./run-tests.py --tmpdir='/tmp/hg test' and introduces other tests for spaces and shell quoting
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 24 Mar 2010 01:43:24 +0100
parents 4f38d03d4975
children 48c8eb9de0c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 #!/bin/sh
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 "$TESTDIR/hghave" svn || exit 80
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
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
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
17 filterpath="s|$escapedwd|/root|"
10423
caaa1f99d681 test-subrepo-svn: handle svn output changes gracefully
Augie Fackler <durin42@gmail.com>
parents: 10273
diff changeset
18 filtersvn='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 echo % create subversion repo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 SVNREPO="file://$escapedwd/svn-repo"
10267
7e3a685be2f3 test-subrepo-svn: remove bashism
Mads Kiilerich <mads@kiilerich.com>
parents: 10198
diff changeset
23 WCROOT="`pwd`/svn-wc"
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 svnadmin create svn-repo
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
25 svn co "$SVNREPO" svn-wc
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 cd svn-wc
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
27 mkdir src
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
28 echo alpha > src/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
29 svn add src
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
30 mkdir externals
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
31 echo other > externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
32 svn add externals
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 svn ci -m 'Add alpha'
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
34 svn up
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
35 cat > extdef <<EOF
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
36 externals -r1 "$SVNREPO/externals"
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
37 EOF
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
38 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
39 svn ci -m 'Setting externals'
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 cd ..
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 echo % create hg repo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 mkdir sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 cd sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 hg init t
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 cd t
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48 echo % first revision, no sub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 echo a > a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 hg ci -Am0
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51
10457
4f38d03d4975 subrepo: make sure that the source path is stripped
David Soria Parra <dsp@php.net>
parents: 10423
diff changeset
52 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
53 echo "s = [svn] $SVNREPO/src" >> .hgsub
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
54 svn co --quiet "$SVNREPO"/src s
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 hg add .hgsub
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
56 hg ci -m1
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
57 echo % debugsub
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
58 hg debugsub | sed "$filterpath"
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
59
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
60 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
61 echo % change file in svn and hg, commit
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
62 echo a >> a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
63 echo alpha >> s/alpha
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
64 hg commit -m 'Message!'
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
65 hg debugsub | sed "$filterpath"
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
66
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
67 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
68 echo a > s/a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
69 echo % should be empty despite change to s/a
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
70 hg st
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
71
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
72 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
73 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
74 cd "$WCROOT"/src
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
75 svn up
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
76 echo xyz >> alpha
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
77 svn propset svn:mime-type 'text/xml' alpha
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
78 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
79 cd ../../sub/t
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
80
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 echo % this commit from hg will fail
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 echo zzz >> s/alpha
10423
caaa1f99d681 test-subrepo-svn: handle svn output changes gracefully
Augie Fackler <durin42@gmail.com>
parents: 10273
diff changeset
83 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filtersvn"
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
84 svn revert -q s/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
85
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
86 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
87 svn propset svn:mime-type 'text/html' s/alpha
10423
caaa1f99d681 test-subrepo-svn: handle svn output changes gracefully
Augie Fackler <durin42@gmail.com>
parents: 10273
diff changeset
88 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filtersvn"
10273
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
89 svn revert -q s/alpha
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
90
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
91 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
92 echo zzz > s/externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
93 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
94 svn revert -q s/externals/other
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
95
e898bc7810ad subrepo: handle svn externals and meta changes (issue1982)
Patrick Mezard <pmezard@gmail.com>
parents: 10267
diff changeset
96 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
97 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
98 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
99 svn revert -q s/externals/other
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
100
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
101 echo
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
102 echo % clone
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
103 cd ..
10198
c2168d170f05 test-subrepo-svn: normalize OS specific path separator
Patrick Mezard <pmezard@gmail.com>
parents: 10196
diff changeset
104 hg clone t tc | fix_path
10178
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
105 cd tc
cd477be6f2fc subrepo: Subversion support
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
106 echo % debugsub in clone
10775
c52057614c72 Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents: 10457
diff changeset
107 hg debugsub | sed "$filterpath"