##// END OF EJS Templates
tests: unify test-subrepo-svn
Martin Geisler -
r11916:d1ea16ca default
parent child Browse files
Show More
@@ -1,113 +1,193 b''
1 #!/bin/sh
2
3 "$TESTDIR/hghave" svn || exit 80
1 $ "$TESTDIR/hghave" svn || exit 80
4 2
5 fix_path()
6 {
7 tr '\\' /
8 }
3 $ fix_path()
4 > {
5 > tr '\\' /
6 > }
7
8 $ escapedwd=`pwd | fix_path`
9 9
10 escapedwd=`pwd | fix_path`
11 # SVN wants all paths to start with a slash. Unfortunately,
12 # Windows ones don't. Handle that.
13 expr "$escapedwd" : "\/" > /dev/null
14 if [ $? -ne 0 ]; then
15 escapedwd="/$escapedwd"
16 fi
17 escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"`
18 filterpath="s|$escapedwd|/root|"
19 filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
20 filterexternal="s|Fetching external item into '.*/s/externals'|Fetching external item into 's/externals'|g"
10 SVN wants all paths to start with a slash. Unfortunately, Windows ones
11 don't. Handle that.
21 12
22 echo % create subversion repo
13 $ expr "$escapedwd" : "\/" > /dev/null
14 $ if [ $? -ne 0 ]; then
15 > escapedwd="/$escapedwd"
16 > fi
17 $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"`
18 $ filterpath="s|$escapedwd|/root|"
19 $ filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
20
21 create subversion repo
23 22
24 SVNREPO="file://$escapedwd/svn-repo"
25 WCROOT="`pwd`/svn-wc"
26 svnadmin create svn-repo
27 svn co "$SVNREPO" svn-wc
28 cd svn-wc
29 mkdir src
30 echo alpha > src/alpha
31 svn add src
32 mkdir externals
33 echo other > externals/other
34 svn add externals
35 svn ci -m 'Add alpha'
36 svn up
37 cat > extdef <<EOF
38 externals -r1 $SVNREPO/externals
39 EOF
40 svn propset -F extdef svn:externals src
41 svn ci -m 'Setting externals'
42 cd ..
23 $ SVNREPO="file://$escapedwd/svn-repo"
24 $ WCROOT="`pwd`/svn-wc"
25 $ svnadmin create svn-repo
26 $ svn co "$SVNREPO" svn-wc
27 Checked out revision 0.
28 $ cd svn-wc
29 $ mkdir src
30 $ echo alpha > src/alpha
31 $ svn add src
32 A src
33 A src/alpha
34 $ mkdir externals
35 $ echo other > externals/other
36 $ svn add externals
37 A externals
38 A externals/other
39 $ svn ci -m 'Add alpha'
40 Adding externals
41 Adding externals/other
42 Adding src
43 Adding src/alpha
44 Transmitting file data ..
45 Committed revision 1.
46 $ svn up
47 At revision 1.
48 $ echo "externals -r1 $SVNREPO/externals" > extdef
49 $ svn propset -F extdef svn:externals src
50 property 'svn:externals' set on 'src'
51 $ svn ci -m 'Setting externals'
52 Sending src
53
54 Committed revision 2.
55 $ cd ..
43 56
44 echo % create hg repo
45 mkdir sub
46 cd sub
47 hg init t
48 cd t
57 create hg repo
58
59 $ mkdir sub
60 $ cd sub
61 $ hg init t
62 $ cd t
63
64 first revision, no sub
65
66 $ echo a > a
67 $ hg ci -Am0
68 adding a
69
70 add first svn sub with leading whitespaces
49 71
50 echo % first revision, no sub
51 echo a > a
52 hg ci -Am0
72 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
73 $ svn co --quiet "$SVNREPO"/src s
74 $ hg add .hgsub
75 $ hg ci -m1
76 committing subrepository s
77
78 debugsub
79
80 $ hg debugsub | sed "$filterpath"
81 path s
82 source file:///root/svn-repo/src
83 revision 2
84
85 change file in svn and hg, commit
53 86
54 echo % add first svn sub with leading whitespaces
55 echo "s = [svn] $SVNREPO/src" >> .hgsub
56 svn co --quiet "$SVNREPO"/src s
57 hg add .hgsub
58 hg ci -m1
59 echo % debugsub
60 hg debugsub | sed "$filterpath"
87 $ echo a >> a
88 $ echo alpha >> s/alpha
89 $ hg commit -m 'Message!' \
90 > | sed 's:Sending.*s/alpha:Sending s/alpha:g'
91 committing subrepository s
92 Sending s/alpha
93 Transmitting file data .
94 Committed revision 3.
95
96 Fetching external item into '.*/s/externals'
97 External at revision 1.
98
99 At revision 3.
100 $ hg debugsub | sed "$filterpath"
101 path s
102 source file:///root/svn-repo/src
103 revision 3
104
105 $ echo a > s/a
106
107 should be empty despite change to s/a
108
109 $ hg st
110
111 add a commit from svn
61 112
62 echo
63 echo % change file in svn and hg, commit
64 echo a >> a
65 echo alpha >> s/alpha
66 hg commit -m 'Message!' | sed "$filterexternal" \
67 | sed 's:Sending.*s/alpha:Sending s/alpha:g'
68 hg debugsub | sed "$filterpath"
113 $ cd "$WCROOT"/src
114 $ svn up
115 U alpha
116
117 Fetching external item into 'externals'
118 A externals/other
119 Updated external to revision 1.
120
121 Updated to revision 3.
122 $ echo xyz >> alpha
123 $ svn propset svn:mime-type 'text/xml' alpha
124 property 'svn:mime-type' set on 'alpha'
125 $ svn ci -m 'amend a from svn'
126 Sending src/alpha
127 Transmitting file data .
128 Committed revision 4.
129 $ cd ../../sub/t
69 130
70 echo
71 echo a > s/a
72 echo % should be empty despite change to s/a
73 hg st
131 this commit from hg will fail
74 132
75 echo
76 echo % add a commit from svn
77 cd "$WCROOT"/src
78 svn up
79 echo xyz >> alpha
80 svn propset svn:mime-type 'text/xml' alpha
81 svn ci -m 'amend a from svn'
82 cd ../../sub/t
133 $ echo zzz >> s/alpha
134 $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
135 committing subrepository s
136 abort: svn: Commit failed (details follow):
137 svn: File '/src/alpha' is out of date
138 $ svn revert -q s/alpha
83 139
84 echo % this commit from hg will fail
85 echo zzz >> s/alpha
86 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
87 svn revert -q s/alpha
140 this commit fails because of meta changes
141
142 $ svn propset svn:mime-type 'text/html' s/alpha
143 property 'svn:mime-type' set on 's/alpha'
144 $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
145 committing subrepository s
146 abort: svn: Commit failed (details follow):
147 svn: File '/src/alpha' is out of date
148 $ svn revert -q s/alpha
149
150 this commit fails because of externals changes
88 151
89 echo % this commit fails because of meta changes
90 svn propset svn:mime-type 'text/html' s/alpha
91 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
92 svn revert -q s/alpha
152 $ echo zzz > s/externals/other
153 $ hg ci -m 'amend externals from hg'
154 committing subrepository s
155 abort: cannot commit svn externals
156 $ svn revert -q s/externals/other
93 157
94 echo % this commit fails because of externals changes
95 echo zzz > s/externals/other
96 hg ci -m 'amend externals from hg'
97 svn revert -q s/externals/other
158 this commit fails because of externals meta changes
159
160 $ svn propset svn:mime-type 'text/html' s/externals/other
161 property 'svn:mime-type' set on 's/externals/other'
162 $ hg ci -m 'amend externals from hg'
163 committing subrepository s
164 abort: cannot commit svn externals
165 $ svn revert -q s/externals/other
98 166
99 echo % this commit fails because of externals meta changes
100 svn propset svn:mime-type 'text/html' s/externals/other
101 hg ci -m 'amend externals from hg'
102 svn revert -q s/externals/other
167 clone
103 168
104 echo
105 echo % clone
106 cd ..
107 hg clone t tc | fix_path
108 cd tc
109 echo % debugsub in clone
110 hg debugsub | sed "$filterpath"
169 $ cd ..
170 $ hg clone t tc | fix_path
171 updating to branch default
172 A tc/s/alpha
173 U tc/s
174
175 Fetching external item into 'tc/s/externals'
176 A tc/s/externals/other
177 Checked out external at revision 1.
178
179 Checked out revision 3.
180 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 $ cd tc
111 182
112 echo % verify subrepo is contained within the repo directory
113 python -c "import os.path; print os.path.exists('s')"
183 debugsub in clone
184
185 $ hg debugsub | sed "$filterpath"
186 path s
187 source file:///root/svn-repo/src
188 revision 3
189
190 verify subrepo is contained within the repo directory
191
192 $ python -c "import os.path; print os.path.exists('s')"
193 True
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now