##// END OF EJS Templates
tests: make tests for convert with svn portable...
FUJIWARA Katsunori -
r28533:dfd5a683 default
parent child Browse files
Show More
@@ -1,122 +1,122
1 1 #require svn svn-bindings
2 2
3 3 $ filter_svn_output () {
4 > egrep -v 'Committing|Updating' | sed -e 's/done$//' || true
4 > egrep -v 'Committing|Updating|(^$)' | sed -e 's/done$//' || true
5 5 > }
6 6
7 7 $ cat <<EOF >> $HGRCPATH
8 8 > [extensions]
9 9 > convert =
10 10 > mq =
11 11 > EOF
12 12
13 13 $ SVNREPOPATH=`pwd`/svn-repo
14 14 #if windows
15 15 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
16 16 #else
17 17 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
18 18 #endif
19 19
20 20 $ svnadmin create "$SVNREPOPATH"
21 21 $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF
22 22 > #!/bin/sh
23 23 >
24 24 > REPOS="$1"
25 25 > REV="$2"
26 26 > USER="$3"
27 27 > PROPNAME="$4"
28 28 > ACTION="$5"
29 29 >
30 30 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
31 31 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
32 32 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
33 33 >
34 34 > echo "Changing prohibited revision property" >&2
35 35 > exit 1
36 36 > EOF
37 37 $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change
38 38 $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc
39 39 Checked out revision 0.
40 40 $ cd "$SVNREPOPATH"-wc
41 41 $ echo a > a
42 42 $ svn add a
43 43 A a
44 44 $ svn ci -m'added a' a | filter_svn_output
45 45 Adding a
46 46 Transmitting file data .
47 47 Committed revision 1.
48 48 $ cd ..
49 49
50 50 initial roundtrip
51 51
52 52 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing
53 53 scanning source...
54 54 sorting...
55 55 converting...
56 56 0 added a
57 57 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
58 58 scanning source...
59 59 sorting...
60 60 converting...
61 61
62 62 second roundtrip should do nothing
63 63
64 64 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
65 65 scanning source...
66 66 sorting...
67 67 converting...
68 68 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
69 69 scanning source...
70 70 sorting...
71 71 converting...
72 72
73 73 new hg rev
74 74
75 75 $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work
76 76 updating to branch default
77 77 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 78 $ cd "$SVNREPOPATH"-work
79 79 $ echo b > b
80 80 $ hg add b
81 81 $ hg ci -mb
82 82
83 83 adding an empty revision
84 84
85 85 $ hg qnew -m emtpy empty
86 86 $ hg qfinish -a
87 87 $ cd ..
88 88
89 89 echo hg to svn
90 90
91 91 $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work
92 92 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
93 93 scanning source...
94 94 sorting...
95 95 converting...
96 96 1 b
97 97 0 emtpy
98 98
99 99 svn back to hg should do nothing
100 100
101 101 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
102 102 scanning source...
103 103 sorting...
104 104 converting...
105 105
106 106 hg back to svn should do nothing
107 107
108 108 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
109 109 scanning source...
110 110 sorting...
111 111 converting...
112 112
113 113 verify which shamap format we are storing and must be able to handle
114 114
115 115 $ cat svn-repo-hg/.hg/shamap
116 116 svn:????????-????-????-????-????????????@1 ???????????????????????????????????????? (glob)
117 117 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
118 118 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
119 119 $ cat svn-repo-wc/.svn/hg-shamap
120 120 ???????????????????????????????????????? 1 (glob)
121 121 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
122 122 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
@@ -1,255 +1,255
1 1 #require svn svn-bindings
2 2
3 3 $ filter_svn_output () {
4 > egrep -v 'Committing|Updating' | sed -e 's/done$//' || true
4 > egrep -v 'Committing|Updating|(^$)' | sed -e 's/done$//' || true
5 5 > }
6 6
7 7 $ cat >> $HGRCPATH <<EOF
8 8 > [extensions]
9 9 > convert =
10 10 > [convert]
11 11 > svn.trunk = mytrunk
12 12 > EOF
13 13
14 14 $ svnadmin create svn-repo
15 15 $ SVNREPOPATH=`pwd`/svn-repo
16 16 #if windows
17 17 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
18 18 #else
19 19 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
20 20 #endif
21 21 $ INVALIDREVISIONID=svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1
22 22 $ VALIDREVISIONID=svn:a2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk/mytrunk@1
23 23
24 24 Now test that it works with trunk/tags layout, but no branches yet.
25 25
26 26 Initial svn import
27 27
28 28 $ mkdir projB
29 29 $ cd projB
30 30 $ mkdir mytrunk
31 31 $ mkdir tags
32 32 $ cd ..
33 33
34 34 $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | filter_svn_output | sort
35 35 Adding projB/mytrunk (glob)
36 36 Adding projB/tags (glob)
37 37 Committed revision 1.
38 38
39 39 Update svn repository
40 40
41 41 $ svn co "$SVNREPOURL/proj%20B/mytrunk" B | filter_svn_output
42 42 Checked out revision 1.
43 43 $ cd B
44 44 $ echo hello > 'letter .txt'
45 45 $ svn add 'letter .txt' | filter_svn_output
46 46 A letter .txt
47 47 $ svn ci -m hello | filter_svn_output
48 48 Adding letter .txt
49 49 Transmitting file data .
50 50 Committed revision 2.
51 51
52 52 $ svn-safe-append.py world 'letter .txt'
53 53 $ svn ci -m world | filter_svn_output
54 54 Sending letter .txt
55 55 Transmitting file data .
56 56 Committed revision 3.
57 57
58 58 $ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1" | filter_svn_output
59 59 Committed revision 4.
60 60
61 61 $ svn-safe-append.py 'nice day today!' 'letter .txt'
62 62 $ svn ci -m "nice day" | filter_svn_output
63 63 Sending letter .txt
64 64 Transmitting file data .
65 65 Committed revision 5.
66 66 $ cd ..
67 67
68 68 Convert to hg once and also test localtimezone option
69 69
70 70 NOTE: This doesn't check all time zones -- it merely determines that
71 71 the configuration option is taking effect.
72 72
73 73 An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
74 74 since it does not use DST (unlike other U.S. time zones) and is always
75 75 a fixed difference from UTC.
76 76
77 77 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
78 78 initializing destination B-hg repository
79 79 scanning source...
80 80 sorting...
81 81 converting...
82 82 3 init projB
83 83 2 hello
84 84 1 world
85 85 0 nice day
86 86 updating tags
87 87
88 88 Update svn repository again
89 89
90 90 $ cd B
91 91 $ svn-safe-append.py "see second letter" 'letter .txt'
92 92 $ echo "nice to meet you" > letter2.txt
93 93 $ svn add letter2.txt | filter_svn_output
94 94 A letter2.txt
95 95 $ svn ci -m "second letter" | filter_svn_output
96 96 Sending letter .txt
97 97 Adding letter2.txt
98 98 Transmitting file data ..
99 99 Committed revision 6.
100 100
101 101 $ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2" | filter_svn_output
102 102 Committed revision 7.
103 103
104 104 $ svn-safe-append.py "blah-blah-blah" letter2.txt
105 105 $ svn ci -m "work in progress" | filter_svn_output
106 106 Sending letter2.txt
107 107 Transmitting file data .
108 108 Committed revision 8.
109 109 $ cd ..
110 110
111 111 $ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest
112 112 initializing destination dest repository
113 113 abort: no revision found in module /proj B/non-existent-path
114 114 [255]
115 115
116 116 ########################################
117 117
118 118 Test incremental conversion
119 119
120 120 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True "$SVNREPOURL/proj%20B" B-hg
121 121 scanning source...
122 122 sorting...
123 123 converting...
124 124 1 second letter
125 125 0 work in progress
126 126 updating tags
127 127
128 128 $ cd B-hg
129 129 $ hg log -G --template '{rev} {desc|firstline} date: {date|date} files: {files}\n'
130 130 o 7 update tags date: * +0000 files: .hgtags (glob)
131 131 |
132 132 o 6 work in progress date: * -1000 files: letter2.txt (glob)
133 133 |
134 134 o 5 second letter date: * -1000 files: letter .txt letter2.txt (glob)
135 135 |
136 136 o 4 update tags date: * +0000 files: .hgtags (glob)
137 137 |
138 138 o 3 nice day date: * -1000 files: letter .txt (glob)
139 139 |
140 140 o 2 world date: * -1000 files: letter .txt (glob)
141 141 |
142 142 o 1 hello date: * -1000 files: letter .txt (glob)
143 143 |
144 144 o 0 init projB date: * -1000 files: (glob)
145 145
146 146 $ hg tags -q
147 147 tip
148 148 v0.2
149 149 v0.1
150 150 $ cd ..
151 151
152 152 Test filemap
153 153 $ echo 'include letter2.txt' > filemap
154 154 $ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap
155 155 initializing destination fmap repository
156 156 scanning source...
157 157 sorting...
158 158 converting...
159 159 5 init projB
160 160 4 hello
161 161 3 world
162 162 2 nice day
163 163 1 second letter
164 164 0 work in progress
165 165 $ hg -R fmap branch -q
166 166 default
167 167 $ hg log -G -R fmap --template '{rev} {desc|firstline} files: {files}\n'
168 168 o 1 work in progress files: letter2.txt
169 169 |
170 170 o 0 second letter files: letter2.txt
171 171
172 172 Convert with --full adds and removes files that didn't change
173 173
174 174 $ cd B
175 175 $ echo >> "letter .txt"
176 176 $ svn ci -m 'nothing' | filter_svn_output
177 177 Sending letter .txt
178 178 Transmitting file data .
179 179 Committed revision 9.
180 180 $ cd ..
181 181
182 182 $ echo 'rename letter2.txt letter3.txt' > filemap
183 183 $ hg convert --filemap filemap --full "$SVNREPOURL/proj%20B/mytrunk" fmap
184 184 scanning source...
185 185 sorting...
186 186 converting...
187 187 0 nothing
188 188 $ hg -R fmap st --change tip
189 189 A letter .txt
190 190 A letter3.txt
191 191 R letter2.txt
192 192
193 193 test invalid splicemap1
194 194
195 195 $ cat > splicemap <<EOF
196 196 > $INVALIDREVISIONID $VALIDREVISIONID
197 197 > EOF
198 198 $ hg convert --splicemap splicemap "$SVNREPOURL/proj%20B/mytrunk" smap
199 199 initializing destination smap repository
200 200 abort: splicemap entry svn:x2147622-4a9f-4db4-a8d3-13562ff547b2/proj%20B/mytrunk@1 is not a valid revision identifier
201 201 [255]
202 202
203 203 Test stop revision
204 204 $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
205 205 initializing destination stoprev repository
206 206 scanning source...
207 207 sorting...
208 208 converting...
209 209 0 init projB
210 210 $ hg -R stoprev branch -q
211 211 default
212 212
213 213 Check convert_revision extra-records.
214 214 This is also the only place testing more than one extra field in a revision.
215 215
216 216 $ cd stoprev
217 217 $ hg tip --debug | grep extra
218 218 extra: branch=default
219 219 extra: convert_revision=svn:........-....-....-....-............/proj B/mytrunk@1 (re)
220 220 $ cd ..
221 221
222 222 Test converting empty heads (issue3347).
223 223 Also tests getting logs directly without debugsvnlog.
224 224
225 225 $ svnadmin create svn-empty
226 226 $ svnadmin load -q svn-empty < "$TESTDIR/svn/empty.svndump"
227 227 $ hg --config convert.svn.trunk= --config convert.svn.debugsvnlog=0 convert svn-empty
228 228 assuming destination svn-empty-hg
229 229 initializing destination svn-empty-hg repository
230 230 scanning source...
231 231 sorting...
232 232 converting...
233 233 1 init projA
234 234 0 adddir
235 235 $ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk"
236 236 assuming destination trunk-hg
237 237 initializing destination trunk-hg repository
238 238 scanning source...
239 239 sorting...
240 240 converting...
241 241 1 init projA
242 242 0 adddir
243 243
244 244 Test that a too-new repository format is properly rejected:
245 245 $ mv svn-empty/format format
246 246 $ echo 999 > svn-empty/format
247 247 It's important that this command explicitly specify svn, otherwise it
248 248 can have surprising side effects (like falling back to a perforce
249 249 depot that can be seen from the test environment and slurping from that.)
250 250 $ hg convert --source-type svn svn-empty this-will-fail
251 251 initializing destination this-will-fail repository
252 252 file:/*/$TESTTMP/svn-empty does not look like a Subversion repository to libsvn version 1.*.* (glob)
253 253 abort: svn-empty: missing or unsupported repository
254 254 [255]
255 255 $ mv format svn-empty/format
@@ -1,643 +1,641
1 1 #require svn15
2 2
3 3 $ SVNREPOPATH=`pwd`/svn-repo
4 4 #if windows
5 5 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
6 6 #else
7 7 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
8 8 #endif
9 9
10 10 $ filter_svn_output () {
11 > egrep -v 'Committing|Transmitting|Updating' || true
11 > egrep -v 'Committing|Transmitting|Updating|(^$)' || true
12 12 > }
13 13
14 14 create subversion repo
15 15
16 16 $ WCROOT="`pwd`/svn-wc"
17 17 $ svnadmin create svn-repo
18 18 $ svn co "$SVNREPOURL" svn-wc
19 19 Checked out revision 0.
20 20 $ cd svn-wc
21 21 $ mkdir src
22 22 $ echo alpha > src/alpha
23 23 $ svn add src
24 24 A src
25 25 A src/alpha (glob)
26 26 $ mkdir externals
27 27 $ echo other > externals/other
28 28 $ svn add externals
29 29 A externals
30 30 A externals/other (glob)
31 31 $ svn ci -qm 'Add alpha'
32 32 $ svn up -q
33 33 $ echo "externals -r1 $SVNREPOURL/externals" > extdef
34 34 $ svn propset -F extdef svn:externals src
35 35 property 'svn:externals' set on 'src'
36 36 $ svn ci -qm 'Setting externals'
37 37 $ cd ..
38 38
39 39 create hg repo
40 40
41 41 $ mkdir sub
42 42 $ cd sub
43 43 $ hg init t
44 44 $ cd t
45 45
46 46 first revision, no sub
47 47
48 48 $ echo a > a
49 49 $ hg ci -Am0
50 50 adding a
51 51
52 52 add first svn sub with leading whitespaces
53 53
54 54 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
55 55 $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub
56 56 $ svn co --quiet "$SVNREPOURL"/src s
57 57 $ mkdir subdir
58 58 $ svn co --quiet "$SVNREPOURL"/src subdir/s
59 59 $ hg add .hgsub
60 60 $ hg ci -m1
61 61
62 62 make sure we avoid empty commits (issue2445)
63 63
64 64 $ hg sum
65 65 parent: 1:* tip (glob)
66 66 1
67 67 branch: default
68 68 commit: (clean)
69 69 update: (current)
70 70 phases: 2 draft
71 71 $ hg ci -moops
72 72 nothing changed
73 73 [1]
74 74
75 75 debugsub
76 76
77 77 $ hg debugsub
78 78 path s
79 79 source file://*/svn-repo/src (glob)
80 80 revision 2
81 81 path subdir/s
82 82 source file://*/svn-repo/src (glob)
83 83 revision 2
84 84
85 85 change file in svn and hg, commit
86 86
87 87 $ echo a >> a
88 88 $ echo alpha >> s/alpha
89 89 $ hg sum
90 90 parent: 1:* tip (glob)
91 91 1
92 92 branch: default
93 93 commit: 1 modified, 1 subrepos
94 94 update: (current)
95 95 phases: 2 draft
96 96 $ hg commit --subrepos -m 'Message!' | filter_svn_output
97 97 committing subrepository s
98 98 Sending*s/alpha (glob)
99 99 Committed revision 3.
100
101 100 Fetching external item into '*s/externals'* (glob)
102 101 External at revision 1.
103
104 102 At revision 3.
105 103 $ hg debugsub
106 104 path s
107 105 source file://*/svn-repo/src (glob)
108 106 revision 3
109 107 path subdir/s
110 108 source file://*/svn-repo/src (glob)
111 109 revision 2
112 110
113 111 missing svn file, commit should fail
114 112
115 113 $ rm s/alpha
116 114 $ hg commit --subrepos -m 'abort on missing file'
117 115 committing subrepository s
118 116 abort: cannot commit missing svn entries (in subrepo s)
119 117 [255]
120 118 $ svn revert s/alpha > /dev/null
121 119
122 120 add an unrelated revision in svn and update the subrepo to without
123 121 bringing any changes.
124 122
125 123 $ svn mkdir "$SVNREPOURL/unrelated" -qm 'create unrelated'
126 124 $ svn up -q s
127 125 $ hg sum
128 126 parent: 2:* tip (glob)
129 127 Message!
130 128 branch: default
131 129 commit: (clean)
132 130 update: (current)
133 131 phases: 3 draft
134 132
135 133 $ echo a > s/a
136 134
137 135 should be empty despite change to s/a
138 136
139 137 $ hg st
140 138
141 139 add a commit from svn
142 140
143 141 $ cd "$WCROOT/src"
144 142 $ svn up -q
145 143 $ echo xyz >> alpha
146 144 $ svn propset svn:mime-type 'text/xml' alpha
147 145 property 'svn:mime-type' set on 'alpha'
148 146 $ svn ci -qm 'amend a from svn'
149 147 $ cd ../../sub/t
150 148
151 149 this commit from hg will fail
152 150
153 151 $ echo zzz >> s/alpha
154 152 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
155 153 committing subrepository s
156 154 abort: svn:*Commit failed (details follow): (glob)
157 155 [255]
158 156 $ svn revert -q s/alpha
159 157
160 158 this commit fails because of meta changes
161 159
162 160 $ svn propset svn:mime-type 'text/html' s/alpha
163 161 property 'svn:mime-type' set on 's/alpha' (glob)
164 162 $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date'
165 163 committing subrepository s
166 164 abort: svn:*Commit failed (details follow): (glob)
167 165 [255]
168 166 $ svn revert -q s/alpha
169 167
170 168 this commit fails because of externals changes
171 169
172 170 $ echo zzz > s/externals/other
173 171 $ hg ci --subrepos -m 'amend externals from hg'
174 172 committing subrepository s
175 173 abort: cannot commit svn externals (in subrepo s)
176 174 [255]
177 175 $ hg diff --subrepos -r 1:2 | grep -v diff
178 176 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
179 177 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
180 178 @@ -1,2 +1,2 @@
181 179 -2 s
182 180 +3 s
183 181 2 subdir/s
184 182 --- a/a Thu Jan 01 00:00:00 1970 +0000
185 183 +++ b/a Thu Jan 01 00:00:00 1970 +0000
186 184 @@ -1,1 +1,2 @@
187 185 a
188 186 +a
189 187 $ svn revert -q s/externals/other
190 188
191 189 this commit fails because of externals meta changes
192 190
193 191 $ svn propset svn:mime-type 'text/html' s/externals/other
194 192 property 'svn:mime-type' set on 's/externals/other' (glob)
195 193 $ hg ci --subrepos -m 'amend externals from hg'
196 194 committing subrepository s
197 195 abort: cannot commit svn externals (in subrepo s)
198 196 [255]
199 197 $ svn revert -q s/externals/other
200 198
201 199 clone
202 200
203 201 $ cd ..
204 202 $ hg clone t tc
205 203 updating to branch default
206 204 A tc/s/alpha (glob)
207 205 U tc/s (glob)
208 206
209 207 Fetching external item into 'tc/s/externals'* (glob)
210 208 A tc/s/externals/other (glob)
211 209 Checked out external at revision 1.
212 210
213 211 Checked out revision 3.
214 212 A tc/subdir/s/alpha (glob)
215 213 U tc/subdir/s (glob)
216 214
217 215 Fetching external item into 'tc/subdir/s/externals'* (glob)
218 216 A tc/subdir/s/externals/other (glob)
219 217 Checked out external at revision 1.
220 218
221 219 Checked out revision 2.
222 220 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 221 $ cd tc
224 222
225 223 debugsub in clone
226 224
227 225 $ hg debugsub
228 226 path s
229 227 source file://*/svn-repo/src (glob)
230 228 revision 3
231 229 path subdir/s
232 230 source file://*/svn-repo/src (glob)
233 231 revision 2
234 232
235 233 verify subrepo is contained within the repo directory
236 234
237 235 $ $PYTHON -c "import os.path; print os.path.exists('s')"
238 236 True
239 237
240 238 update to nullrev (must delete the subrepo)
241 239
242 240 $ hg up null
243 241 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
244 242 $ ls
245 243
246 244 Check hg update --clean
247 245 $ cd "$TESTTMP/sub/t"
248 246 $ cd s
249 247 $ echo c0 > alpha
250 248 $ echo c1 > f1
251 249 $ echo c1 > f2
252 250 $ svn add f1 -q
253 251 $ svn status | sort
254 252
255 253 ? * a (glob)
256 254 ? * f2 (glob)
257 255 A * f1 (glob)
258 256 M * alpha (glob)
259 257 Performing status on external item at 'externals'* (glob)
260 258 X * externals (glob)
261 259 $ cd ../..
262 260 $ hg -R t update -C
263 261
264 262 Fetching external item into 't/s/externals'* (glob)
265 263 Checked out external at revision 1.
266 264
267 265 Checked out revision 3.
268 266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 267 $ cd t/s
270 268 $ svn status | sort
271 269
272 270 ? * a (glob)
273 271 ? * f1 (glob)
274 272 ? * f2 (glob)
275 273 Performing status on external item at 'externals'* (glob)
276 274 X * externals (glob)
277 275
278 276 Sticky subrepositories, no changes
279 277 $ cd "$TESTTMP/sub/t"
280 278 $ hg id -n
281 279 2
282 280 $ cd s
283 281 $ svnversion
284 282 3
285 283 $ cd ..
286 284 $ hg update 1
287 285 U *s/alpha (glob)
288 286
289 287 Fetching external item into '*s/externals'* (glob)
290 288 Checked out external at revision 1.
291 289
292 290 Checked out revision 2.
293 291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 292 $ hg id -n
295 293 1
296 294 $ cd s
297 295 $ svnversion
298 296 2
299 297 $ cd ..
300 298
301 299 Sticky subrepositories, file changes
302 300 $ touch s/f1
303 301 $ cd s
304 302 $ svn add f1
305 303 A f1
306 304 $ cd ..
307 305 $ hg id -n
308 306 1+
309 307 $ cd s
310 308 $ svnversion
311 309 2M
312 310 $ cd ..
313 311 $ hg update tip
314 312 subrepository s diverged (local revision: 2, remote revision: 3)
315 313 (M)erge, keep (l)ocal or keep (r)emote? m
316 314 subrepository sources for s differ
317 315 use (l)ocal source (2) or (r)emote source (3)? l
318 316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 317 $ hg id -n
320 318 2+
321 319 $ cd s
322 320 $ svnversion
323 321 2M
324 322 $ cd ..
325 323 $ hg update --clean tip
326 324 U *s/alpha (glob)
327 325
328 326 Fetching external item into '*s/externals'* (glob)
329 327 Checked out external at revision 1.
330 328
331 329 Checked out revision 3.
332 330 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 331
334 332 Sticky subrepository, revision updates
335 333 $ hg id -n
336 334 2
337 335 $ cd s
338 336 $ svnversion
339 337 3
340 338 $ cd ..
341 339 $ cd s
342 340 $ svn update -qr 1
343 341 $ cd ..
344 342 $ hg update 1
345 343 subrepository s diverged (local revision: 3, remote revision: 2)
346 344 (M)erge, keep (l)ocal or keep (r)emote? m
347 345 subrepository sources for s differ (in checked out version)
348 346 use (l)ocal source (1) or (r)emote source (2)? l
349 347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
350 348 $ hg id -n
351 349 1+
352 350 $ cd s
353 351 $ svnversion
354 352 1
355 353 $ cd ..
356 354
357 355 Sticky subrepository, file changes and revision updates
358 356 $ touch s/f1
359 357 $ cd s
360 358 $ svn add f1
361 359 A f1
362 360 $ svnversion
363 361 1M
364 362 $ cd ..
365 363 $ hg id -n
366 364 1+
367 365 $ hg update tip
368 366 subrepository s diverged (local revision: 3, remote revision: 3)
369 367 (M)erge, keep (l)ocal or keep (r)emote? m
370 368 subrepository sources for s differ
371 369 use (l)ocal source (1) or (r)emote source (3)? l
372 370 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 371 $ hg id -n
374 372 2+
375 373 $ cd s
376 374 $ svnversion
377 375 1M
378 376 $ cd ..
379 377
380 378 Sticky repository, update --clean
381 379 $ hg update --clean tip | grep -v 's[/\]externals[/\]other'
382 380 U *s/alpha (glob)
383 381 U *s (glob)
384 382
385 383 Fetching external item into '*s/externals'* (glob)
386 384 Checked out external at revision 1.
387 385
388 386 Checked out revision 3.
389 387 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
390 388 $ hg id -n
391 389 2
392 390 $ cd s
393 391 $ svnversion
394 392 3
395 393 $ cd ..
396 394
397 395 Test subrepo already at intended revision:
398 396 $ cd s
399 397 $ svn update -qr 2
400 398 $ cd ..
401 399 $ hg update 1
402 400 subrepository s diverged (local revision: 3, remote revision: 2)
403 401 (M)erge, keep (l)ocal or keep (r)emote? m
404 402 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
405 403 $ hg id -n
406 404 1+
407 405 $ cd s
408 406 $ svnversion
409 407 2
410 408 $ cd ..
411 409
412 410 Test case where subversion would fail to update the subrepo because there
413 411 are unknown directories being replaced by tracked ones (happens with rebase).
414 412
415 413 $ cd "$WCROOT/src"
416 414 $ mkdir dir
417 415 $ echo epsilon.py > dir/epsilon.py
418 416 $ svn add dir
419 417 A dir
420 418 A dir/epsilon.py (glob)
421 419 $ svn ci -qm 'Add dir/epsilon.py'
422 420 $ cd ../..
423 421 $ hg init rebaserepo
424 422 $ cd rebaserepo
425 423 $ svn co -r5 --quiet "$SVNREPOURL"/src s
426 424 $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub
427 425 $ hg add .hgsub
428 426 $ hg ci -m addsub
429 427 $ echo a > a
430 428 $ hg add .
431 429 adding a
432 430 $ hg ci -m adda
433 431 $ hg up 0
434 432 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
435 433 $ svn up -qr6 s
436 434 $ hg ci -m updatesub
437 435 created new head
438 436 $ echo pyc > s/dir/epsilon.pyc
439 437 $ hg up 1
440 438 D *s/dir (glob)
441 439
442 440 Fetching external item into '*s/externals'* (glob)
443 441 Checked out external at revision 1.
444 442
445 443 Checked out revision 5.
446 444 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
447 445 $ hg up -q 2
448 446
449 447 Modify one of the externals to point to a different path so we can
450 448 test having obstructions when switching branches on checkout:
451 449 $ hg checkout tip
452 450 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
453 451 $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub
454 452 $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct
455 453 $ hg commit -m 'Start making obstructed working copy'
456 454 $ hg book other
457 455 $ hg co -r 'p1(tip)'
458 456 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 457 (leaving bookmark other)
460 458 $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub
461 459 $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct
462 460 $ hg commit -m 'Other branch which will be obstructed'
463 461 created new head
464 462
465 463 Switching back to the head where we have another path mapped to the
466 464 same subrepo should work if the subrepo is clean.
467 465 $ hg co other
468 466 A *obstruct/other (glob)
469 467 Checked out revision 1.
470 468 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 469 (activating bookmark other)
472 470
473 471 This is surprising, but is also correct based on the current code:
474 472 $ echo "updating should (maybe) fail" > obstruct/other
475 473 $ hg co tip
476 474 abort: uncommitted changes
477 475 (commit or update --clean to discard changes)
478 476 [255]
479 477
480 478 Point to a Subversion branch which has since been deleted and recreated
481 479 First, create that condition in the repository.
482 480
483 481 $ hg ci --subrepos -m cleanup | filter_svn_output
484 482 committing subrepository obstruct
485 483 Sending obstruct/other (glob)
486 484 Committed revision 7.
487 485 At revision 7.
488 486 $ svn mkdir -qm "baseline" $SVNREPOURL/trunk
489 487 $ svn copy -qm "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch
490 488 $ svn co --quiet "$SVNREPOURL"/branch tempwc
491 489 $ cd tempwc
492 490 $ echo "something old" > somethingold
493 491 $ svn add somethingold
494 492 A somethingold
495 493 $ svn ci -qm 'Something old'
496 494 $ svn rm -qm "remove branch" $SVNREPOURL/branch
497 495 $ svn copy -qm "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch
498 496 $ svn up -q
499 497 $ echo "something new" > somethingnew
500 498 $ svn add somethingnew
501 499 A somethingnew
502 500 $ svn ci -qm 'Something new'
503 501 $ cd ..
504 502 $ rm -rf tempwc
505 503 $ svn co "$SVNREPOURL/branch"@10 recreated
506 504 A recreated/somethingold (glob)
507 505 Checked out revision 10.
508 506 $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub
509 507 $ hg ci -m addsub
510 508 $ cd recreated
511 509 $ svn up -q
512 510 $ cd ..
513 511 $ hg ci -m updatesub
514 512 $ hg up -r-2
515 513 D *recreated/somethingnew (glob)
516 514 A *recreated/somethingold (glob)
517 515 Checked out revision 10.
518 516 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
519 517 (leaving bookmark other)
520 518 $ test -f recreated/somethingold
521 519
522 520 Test archive
523 521
524 522 $ hg archive -S ../archive-all --debug --config progress.debug=true
525 523 archiving: 0/2 files (0.00%)
526 524 archiving: .hgsub 1/2 files (50.00%)
527 525 archiving: .hgsubstate 2/2 files (100.00%)
528 526 archiving (obstruct): 0/1 files (0.00%)
529 527 archiving (obstruct): 1/1 files (100.00%)
530 528 archiving (recreated): 0/1 files (0.00%)
531 529 archiving (recreated): 1/1 files (100.00%)
532 530 archiving (s): 0/2 files (0.00%)
533 531 archiving (s): 1/2 files (50.00%)
534 532 archiving (s): 2/2 files (100.00%)
535 533
536 534 $ hg archive -S ../archive-exclude --debug --config progress.debug=true -X **old
537 535 archiving: 0/2 files (0.00%)
538 536 archiving: .hgsub 1/2 files (50.00%)
539 537 archiving: .hgsubstate 2/2 files (100.00%)
540 538 archiving (obstruct): 0/1 files (0.00%)
541 539 archiving (obstruct): 1/1 files (100.00%)
542 540 archiving (recreated): 0 files
543 541 archiving (s): 0/2 files (0.00%)
544 542 archiving (s): 1/2 files (50.00%)
545 543 archiving (s): 2/2 files (100.00%)
546 544 $ find ../archive-exclude | sort
547 545 ../archive-exclude
548 546 ../archive-exclude/.hg_archival.txt
549 547 ../archive-exclude/.hgsub
550 548 ../archive-exclude/.hgsubstate
551 549 ../archive-exclude/obstruct
552 550 ../archive-exclude/obstruct/other
553 551 ../archive-exclude/s
554 552 ../archive-exclude/s/alpha
555 553 ../archive-exclude/s/dir
556 554 ../archive-exclude/s/dir/epsilon.py
557 555
558 556 Test forgetting files, not implemented in svn subrepo, used to
559 557 traceback
560 558
561 559 #if no-windows
562 560 $ hg forget 'notafile*'
563 561 notafile*: No such file or directory
564 562 [1]
565 563 #else
566 564 $ hg forget 'notafile'
567 565 notafile: * (glob)
568 566 [1]
569 567 #endif
570 568
571 569 Test a subrepo referencing a just moved svn path. Last commit rev will
572 570 be different from the revision, and the path will be different as
573 571 well.
574 572
575 573 $ cd "$WCROOT"
576 574 $ svn up > /dev/null
577 575 $ mkdir trunk/subdir branches
578 576 $ echo a > trunk/subdir/a
579 577 $ svn add trunk/subdir branches
580 578 A trunk/subdir (glob)
581 579 A trunk/subdir/a (glob)
582 580 A branches
583 581 $ svn ci -qm addsubdir
584 582 $ svn cp -qm branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch
585 583 $ cd ..
586 584
587 585 $ hg init repo2
588 586 $ cd repo2
589 587 $ svn co $SVNREPOURL/branches/somebranch/subdir
590 588 A subdir/a (glob)
591 589 Checked out revision 15.
592 590 $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub
593 591 $ hg add .hgsub
594 592 $ hg ci -m addsub
595 593 $ hg up null
596 594 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
597 595 $ hg up
598 596 A *subdir/a (glob)
599 597 Checked out revision 15.
600 598 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
601 599 $ cd ..
602 600
603 601 Test sanitizing ".hg/hgrc" in subrepo
604 602
605 603 $ cd sub/t
606 604 $ hg update -q -C tip
607 605 $ cd s
608 606 $ mkdir .hg
609 607 $ echo '.hg/hgrc in svn repo' > .hg/hgrc
610 608 $ mkdir -p sub/.hg
611 609 $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc
612 610 $ svn add .hg sub
613 611 A .hg
614 612 A .hg/hgrc (glob)
615 613 A sub
616 614 A sub/.hg (glob)
617 615 A sub/.hg/hgrc (glob)
618 616 $ svn ci -qm 'add .hg/hgrc to be sanitized at hg update'
619 617 $ svn up -q
620 618 $ cd ..
621 619 $ hg commit -S -m 'commit with svn revision including .hg/hgrc'
622 620 $ grep ' s$' .hgsubstate
623 621 16 s
624 622 $ cd ..
625 623
626 624 $ hg -R tc pull -u -q 2>&1 | sort
627 625 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob)
628 626 warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob)
629 627 $ cd tc
630 628 $ grep ' s$' .hgsubstate
631 629 16 s
632 630 $ test -f s/.hg/hgrc
633 631 [1]
634 632 $ test -f s/sub/.hg/hgrc
635 633 [1]
636 634
637 635 Test that sanitizing is omitted in meta data area:
638 636
639 637 $ mkdir s/.svn/.hg
640 638 $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc
641 639 $ hg update -q -C '.^1'
642 640
643 641 $ cd ../..
General Comments 0
You need to be logged in to leave comments. Login now