##// END OF EJS Templates
tests: unify test-subrepo-svn
Martin Geisler -
r11916:d1ea16ca default
parent child Browse files
Show More
@@ -1,113 +1,193
1 #!/bin/sh
1 $ "$TESTDIR/hghave" svn || exit 80
2
3 "$TESTDIR/hghave" svn || exit 80
4
2
5 fix_path()
3 $ fix_path()
6 {
4 > {
7 tr '\\' /
5 > tr '\\' /
8 }
6 > }
7
8 $ escapedwd=`pwd | fix_path`
9
9
10 escapedwd=`pwd | fix_path`
10 SVN wants all paths to start with a slash. Unfortunately, Windows ones
11 # SVN wants all paths to start with a slash. Unfortunately,
11 don't. Handle that.
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"
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"
23 $ SVNREPO="file://$escapedwd/svn-repo"
25 WCROOT="`pwd`/svn-wc"
24 $ WCROOT="`pwd`/svn-wc"
26 svnadmin create svn-repo
25 $ svnadmin create svn-repo
27 svn co "$SVNREPO" svn-wc
26 $ svn co "$SVNREPO" svn-wc
28 cd svn-wc
27 Checked out revision 0.
29 mkdir src
28 $ cd svn-wc
30 echo alpha > src/alpha
29 $ mkdir src
31 svn add src
30 $ echo alpha > src/alpha
32 mkdir externals
31 $ svn add src
33 echo other > externals/other
32 A src
34 svn add externals
33 A src/alpha
35 svn ci -m 'Add alpha'
34 $ mkdir externals
36 svn up
35 $ echo other > externals/other
37 cat > extdef <<EOF
36 $ svn add externals
38 externals -r1 $SVNREPO/externals
37 A externals
39 EOF
38 A externals/other
40 svn propset -F extdef svn:externals src
39 $ svn ci -m 'Add alpha'
41 svn ci -m 'Setting externals'
40 Adding externals
42 cd ..
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
57 create hg repo
45 mkdir sub
58
46 cd sub
59 $ mkdir sub
47 hg init t
60 $ cd sub
48 cd t
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
72 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
51 echo a > a
73 $ svn co --quiet "$SVNREPO"/src s
52 hg ci -Am0
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
87 $ echo a >> a
55 echo "s = [svn] $SVNREPO/src" >> .hgsub
88 $ echo alpha >> s/alpha
56 svn co --quiet "$SVNREPO"/src s
89 $ hg commit -m 'Message!' \
57 hg add .hgsub
90 > | sed 's:Sending.*s/alpha:Sending s/alpha:g'
58 hg ci -m1
91 committing subrepository s
59 echo % debugsub
92 Sending s/alpha
60 hg debugsub | sed "$filterpath"
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
113 $ cd "$WCROOT"/src
63 echo % change file in svn and hg, commit
114 $ svn up
64 echo a >> a
115 U alpha
65 echo alpha >> s/alpha
116
66 hg commit -m 'Message!' | sed "$filterexternal" \
117 Fetching external item into 'externals'
67 | sed 's:Sending.*s/alpha:Sending s/alpha:g'
118 A externals/other
68 hg debugsub | sed "$filterpath"
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
131 this commit from hg will fail
71 echo a > s/a
72 echo % should be empty despite change to s/a
73 hg st
74
132
75 echo
133 $ echo zzz >> s/alpha
76 echo % add a commit from svn
134 $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
77 cd "$WCROOT"/src
135 committing subrepository s
78 svn up
136 abort: svn: Commit failed (details follow):
79 echo xyz >> alpha
137 svn: File '/src/alpha' is out of date
80 svn propset svn:mime-type 'text/xml' alpha
138 $ svn revert -q s/alpha
81 svn ci -m 'amend a from svn'
82 cd ../../sub/t
83
139
84 echo % this commit from hg will fail
140 this commit fails because of meta changes
85 echo zzz >> s/alpha
141
86 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
142 $ svn propset svn:mime-type 'text/html' s/alpha
87 svn revert -q 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
152 $ echo zzz > s/externals/other
90 svn propset svn:mime-type 'text/html' s/alpha
153 $ hg ci -m 'amend externals from hg'
91 hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
154 committing subrepository s
92 svn revert -q s/alpha
155 abort: cannot commit svn externals
156 $ svn revert -q s/externals/other
93
157
94 echo % this commit fails because of externals changes
158 this commit fails because of externals meta changes
95 echo zzz > s/externals/other
159
96 hg ci -m 'amend externals from hg'
160 $ svn propset svn:mime-type 'text/html' s/externals/other
97 svn revert -q 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
167 clone
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
103
168
104 echo
169 $ cd ..
105 echo % clone
170 $ hg clone t tc | fix_path
106 cd ..
171 updating to branch default
107 hg clone t tc | fix_path
172 A tc/s/alpha
108 cd tc
173 U tc/s
109 echo % debugsub in clone
174
110 hg debugsub | sed "$filterpath"
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
183 debugsub in clone
113 python -c "import os.path; print os.path.exists('s')"
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
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now