##// END OF EJS Templates
prepush: add more test cases
Peter Arrenbrecht -
r10909:29a83fb8 stable
parent child Browse files
Show More
@@ -1,267 +1,303 b''
1 1 #!/bin/sh
2 2
3 3 echo "[extensions]" >> $HGRCPATH
4 4 echo "graphlog=" >> $HGRCPATH
5 5
6 6 mkdir a
7 7 cd a
8 8 hg init
9 9 echo foo > t1
10 10 hg add t1
11 11 hg commit -m "1" -d "1000000 0"
12 12
13 13 cd ..
14 14 hg clone a b
15 15
16 16 cd a
17 17 echo foo > t2
18 18 hg add t2
19 19 hg commit -m "2" -d "1000000 0"
20 20
21 21 cd ../b
22 22 echo foo > t3
23 23 hg add t3
24 24 hg commit -m "3" -d "1000000 0"
25 25
26 26 hg push ../a
27 27 hg pull ../a
28 28 hg push ../a
29 29 hg merge
30 30 hg commit -m "4" -d "1000000 0"
31 31 hg push ../a
32 32 cd ..
33 33
34 34 hg init c
35 35 cd c
36 36 for i in 0 1 2; do
37 37 echo $i >> foo
38 38 hg ci -Am $i -d "1000000 0"
39 39 done
40 40 cd ..
41 41
42 42 hg clone c d
43 43 cd d
44 44 for i in 0 1; do
45 45 hg co -C $i
46 46 echo d-$i >> foo
47 47 hg ci -m d-$i -d "1000000 0"
48 48 done
49 49
50 50 HGMERGE=true hg merge 3
51 51 hg ci -m c-d -d "1000000 0"
52 52
53 53 hg push ../c; echo $?
54 54 hg push -r 2 ../c; echo $?
55 55 hg push -r 3 ../c; echo $?
56 56 hg push -r 3 -r 4 ../c; echo $?
57 57 hg push -f -r 3 -r 4 ../c; echo $?
58 58 hg push -r 5 ../c; echo $?
59 59 hg in ../c
60 60
61 61 echo % issue 450
62 62 hg init ../e
63 63 hg push -r 0 ../e ; echo $?
64 64 hg push -r 1 ../e ; echo $?
65 65
66 66 cd ..
67 67
68 68 echo % issue 736
69 69 hg init f
70 70 cd f
71 71 hg -q branch a
72 72 echo 0 > foo
73 73 hg -q ci -d "1000000 0" -Am 0
74 74 echo 1 > foo
75 75 hg -q ci -d "1000000 0" -m 1
76 76 hg -q up 0
77 77 echo 2 > foo
78 78 hg -q ci -d "1000000 0" -m 2
79 79 hg -q up 0
80 80 hg -q branch b
81 81 echo 3 > foo
82 82 hg -q ci -d "1000000 0" -m 3
83 83 cd ..
84 84
85 85 hg -q clone f g
86 86 cd g
87 87
88 88 echo % push on existing branch and new branch
89 89 hg -q up 1
90 90 echo 4 > foo
91 91 hg -q ci -d "1000000 0" -m 4
92 92 hg -q up 0
93 93 echo 5 > foo
94 94 hg -q branch c
95 95 hg -q ci -d "1000000 0" -m 5
96 96 hg push ../f; echo $?
97 97 hg push -r 4 -r 5 ../f; echo $?
98 98
99 99 echo % multiple new branches
100 100 hg -q branch d
101 101 echo 6 > foo
102 102 hg -q ci -d "1000000 0" -m 6
103 103 hg push ../f; echo $?
104 104 hg push -r 4 -r 6 ../f; echo $?
105 105 cd ../g
106 106
107 107 echo % fail on multiple head push
108 108 hg -q up 1
109 109 echo 7 > foo
110 110 hg -q ci -d "1000000 0" -m 7
111 111 hg push -r 4 -r 7 ../f; echo $?
112 112
113 113 echo % push replacement head on existing branches
114 114 hg -q up 3
115 115 echo 8 > foo
116 116 hg -q ci -d "1000000 0" -m 8
117 117 hg push -r 7 -r 8 ../f; echo $?
118 118
119 119 echo % merge of branch a to other branch b followed by unrelated push on branch a
120 120 hg -q up 7
121 121 HGMERGE=true hg -q merge 8
122 122 hg -q ci -d "1000000 0" -m 9
123 123 hg -q up 8
124 124 echo 10 > foo
125 125 hg -q ci -d "1000000 0" -m 10
126 126 hg push -r 9 ../f; echo $?
127 127 hg push -r 10 ../f; echo $?
128 128
129 129 echo % cheating the counting algorithm
130 130 hg -q up 9
131 131 HGMERGE=true hg -q merge 2
132 132 hg -q ci -d "1000000 0" -m 11
133 133 hg -q up 1
134 134 echo 12 > foo
135 135 hg -q ci -d "1000000 0" -m 12
136 136 hg push -r 11 -r 12 ../f; echo $?
137 137
138 138 echo % checking prepush logic does not allow silently pushing multiple new heads
139 139 cd ..
140 140 hg init h
141 141 echo init > h/init
142 142 hg -R h ci -Am init
143 143 echo a > h/a
144 144 hg -R h ci -Am a
145 145 hg clone h i
146 146 hg -R h up 0
147 147 echo b > h/b
148 148 hg -R h ci -Am b
149 149 hg -R i up 0
150 150 echo c > i/c
151 151 hg -R i ci -Am c
152 152 hg -R i push h
153 153 echo
154 154
155 155 echo % check prepush logic with merged branches
156 156 hg init j
157 157 hg -R j branch a
158 158 echo init > j/foo
159 159 hg -R j ci -Am init
160 160 hg clone j k
161 161 echo a1 > j/foo
162 162 hg -R j ci -m a1
163 163 hg -R k branch b
164 164 echo b > k/foo
165 165 hg -R k ci -m b
166 166 hg -R k up 0
167 167 hg -R k merge b
168 168 hg -R k ci -m merge
169 169 hg -R k push -r a j
170 170 echo
171 171
172 172 echo % prepush -r should not allow you to sneak in new heads
173 173 hg init l
174 174 cd l
175 175 echo a >> foo
176 176 hg -q add foo
177 177 hg -q branch a
178 178 hg -q ci -d '0 0' -ma
179 179 hg -q up null
180 180 echo a >> foo
181 181 hg -q add foo
182 182 hg -q branch b
183 183 hg -q ci -d '0 0' -mb
184 184 cd ..
185 185 hg -q clone l m -u a
186 186 cd m
187 187 hg -q merge b
188 188 hg -q ci -d '0 0' -mmb
189 189 hg -q up 0
190 190 echo a >> foo
191 191 hg -q ci -ma2
192 192 hg -q up 2
193 193 echo a >> foo
194 194 hg -q branch -f b
195 195 hg -q ci -d '0 0' -mb2
196 196 hg -q merge 3
197 197 hg -q ci -d '0 0' -mma
198 198 hg push ../l -b b
199 199 cd ..
200 200
201 201 echo % check prepush with new branch head on former topo non-head
202 202 hg init n
203 203 cd n
204 204 hg branch A
205 205 echo a >a
206 206 hg ci -Ama
207 207 hg branch B
208 208 echo b >b
209 209 hg ci -Amb
210 210 # b is now branch head of B, and a topological head
211 211 # a is now branch head of A, but not a topological head
212 212 hg clone . inner
213 213 cd inner
214 214 hg up B
215 215 echo b1 >b1
216 216 hg ci -Amb1
217 217 # in the clone b1 is now the head of B
218 218 cd ..
219 219 hg up 0
220 220 echo a2 >a2
221 221 hg ci -Ama2
222 222 # a2 is now the new branch head of A, and a new topological head
223 223 # it replaces a former inner branch head, so it should at most warn about A, not B
224 224 echo %% glog of local
225 225 hg glog --template "{rev}: {branches} {desc}\n"
226 226 echo %% glog of remote
227 227 hg glog -R inner --template "{rev}: {branches} {desc}\n"
228 228 echo %% outgoing
229 229 hg out inner --template "{rev}: {branches} {desc}\n"
230 230 hg push inner
231 231 cd ..
232 232
233 233 echo % check prepush with new branch head on former topo head
234 234 hg init o
235 235 cd o
236 236 hg branch A
237 237 echo a >a
238 238 hg ci -Ama
239 239 hg branch B
240 240 echo b >b
241 241 hg ci -Amb
242 242 # b is now branch head of B, and a topological head
243 243 hg up 0
244 244 echo a1 >a1
245 245 hg ci -Ama1
246 246 # a1 is now branch head of A, and a topological head
247 247 hg clone . inner
248 248 cd inner
249 249 hg up B
250 250 echo b1 >b1
251 251 hg ci -Amb1
252 252 # in the clone b1 is now the head of B
253 253 cd ..
254 254 echo a2 >a2
255 255 hg ci -Ama2
256 256 # a2 is now the new branch head of A, and a topological head
257 257 # it replaces a former topological and branch head, so this should not warn
258 258 echo %% glog of local
259 259 hg glog --template "{rev}: {branches} {desc}\n"
260 260 echo %% glog of remote
261 261 hg glog -R inner --template "{rev}: {branches} {desc}\n"
262 262 echo %% outgoing
263 263 hg out inner --template "{rev}: {branches} {desc}\n"
264 264 hg push inner
265 265 cd ..
266 266
267 echo % check prepush with new branch head and new child of former branch head
268 echo % but child is on different branch
269 hg init p
270 cd p
271 hg branch A
272 echo a0 >a
273 hg ci -Ama0
274 echo a1 >a
275 hg ci -ma1
276 hg up null
277 hg branch B
278 echo b0 >b
279 hg ci -Amb0
280 echo b1 >b
281 hg ci -mb1
282
283 hg clone . inner
284
285 hg up A
286 hg branch -f B
287 echo a3 >a
288 hg ci -ma3
289 hg up 3
290 hg branch -f A
291 echo b3 >b
292 hg ci -mb3
293
294 echo %% glog of local
295 hg glog --template "{rev}: {branches} {desc}\n"
296 echo %% glog of remote
297 hg glog -R inner --template "{rev}: {branches} {desc}\n"
298 echo %% outgoing
299 hg out inner --template "{rev}: {branches} {desc}\n"
300 hg push inner
301 cd ..
302
267 303 exit 0
@@ -1,260 +1,305 b''
1 1 updating to branch default
2 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 3 pushing to ../a
4 4 searching for changes
5 5 abort: push creates new remote heads on branch 'default'!
6 6 (you should pull and merge or use push -f to force)
7 7 pulling from ../a
8 8 searching for changes
9 9 adding changesets
10 10 adding manifests
11 11 adding file changes
12 12 added 1 changesets with 1 changes to 1 files (+1 heads)
13 13 (run 'hg heads' to see heads, 'hg merge' to merge)
14 14 pushing to ../a
15 15 searching for changes
16 16 abort: push creates new remote heads on branch 'default'!
17 17 (did you forget to merge? use push -f to force)
18 18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 19 (branch merge, don't forget to commit)
20 20 pushing to ../a
21 21 searching for changes
22 22 adding changesets
23 23 adding manifests
24 24 adding file changes
25 25 added 2 changesets with 1 changes to 1 files
26 26 adding foo
27 27 updating to branch default
28 28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 30 created new head
31 31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 32 created new head
33 33 merging foo
34 34 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
35 35 (branch merge, don't forget to commit)
36 36 pushing to ../c
37 37 searching for changes
38 38 abort: push creates new remote heads on branch 'default'!
39 39 (did you forget to merge? use push -f to force)
40 40 1
41 41 pushing to ../c
42 42 searching for changes
43 43 no changes found
44 44 0
45 45 pushing to ../c
46 46 searching for changes
47 47 abort: push creates new remote heads on branch 'default'!
48 48 (did you forget to merge? use push -f to force)
49 49 1
50 50 pushing to ../c
51 51 searching for changes
52 52 abort: push creates new remote heads on branch 'default'!
53 53 (did you forget to merge? use push -f to force)
54 54 1
55 55 pushing to ../c
56 56 searching for changes
57 57 adding changesets
58 58 adding manifests
59 59 adding file changes
60 60 added 2 changesets with 2 changes to 1 files (+2 heads)
61 61 0
62 62 pushing to ../c
63 63 searching for changes
64 64 adding changesets
65 65 adding manifests
66 66 adding file changes
67 67 added 1 changesets with 1 changes to 1 files (-1 heads)
68 68 0
69 69 comparing with ../c
70 70 searching for changes
71 71 no changes found
72 72 % issue 450
73 73 pushing to ../e
74 74 searching for changes
75 75 adding changesets
76 76 adding manifests
77 77 adding file changes
78 78 added 1 changesets with 1 changes to 1 files
79 79 0
80 80 pushing to ../e
81 81 searching for changes
82 82 adding changesets
83 83 adding manifests
84 84 adding file changes
85 85 added 1 changesets with 1 changes to 1 files
86 86 0
87 87 % issue 736
88 88 % push on existing branch and new branch
89 89 pushing to ../f
90 90 searching for changes
91 91 abort: push creates new remote branches: c!
92 92 (use 'hg push -f' to force)
93 93 1
94 94 pushing to ../f
95 95 searching for changes
96 96 abort: push creates new remote branches: c!
97 97 (use 'hg push -f' to force)
98 98 1
99 99 % multiple new branches
100 100 pushing to ../f
101 101 searching for changes
102 102 abort: push creates new remote branches: c, d!
103 103 (use 'hg push -f' to force)
104 104 1
105 105 pushing to ../f
106 106 searching for changes
107 107 abort: push creates new remote branches: c, d!
108 108 (use 'hg push -f' to force)
109 109 1
110 110 % fail on multiple head push
111 111 pushing to ../f
112 112 searching for changes
113 113 abort: push creates new remote heads on branch 'a'!
114 114 (did you forget to merge? use push -f to force)
115 115 1
116 116 % push replacement head on existing branches
117 117 pushing to ../f
118 118 searching for changes
119 119 adding changesets
120 120 adding manifests
121 121 adding file changes
122 122 added 2 changesets with 2 changes to 1 files
123 123 0
124 124 % merge of branch a to other branch b followed by unrelated push on branch a
125 125 pushing to ../f
126 126 searching for changes
127 127 adding changesets
128 128 adding manifests
129 129 adding file changes
130 130 added 1 changesets with 1 changes to 1 files (-1 heads)
131 131 0
132 132 pushing to ../f
133 133 searching for changes
134 134 adding changesets
135 135 adding manifests
136 136 adding file changes
137 137 added 1 changesets with 1 changes to 1 files (+1 heads)
138 138 0
139 139 % cheating the counting algorithm
140 140 pushing to ../f
141 141 searching for changes
142 142 adding changesets
143 143 adding manifests
144 144 adding file changes
145 145 added 2 changesets with 2 changes to 1 files
146 146 0
147 147 % checking prepush logic does not allow silently pushing multiple new heads
148 148 adding init
149 149 adding a
150 150 updating to branch default
151 151 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 152 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
153 153 adding b
154 154 created new head
155 155 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
156 156 adding c
157 157 created new head
158 158 pushing to h
159 159 searching for changes
160 160 abort: push creates new remote heads on branch 'default'!
161 161 (you should pull and merge or use push -f to force)
162 162
163 163 % check prepush logic with merged branches
164 164 marked working directory as branch a
165 165 adding foo
166 166 updating to branch a
167 167 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 168 marked working directory as branch b
169 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 171 (branch merge, don't forget to commit)
172 172 pushing to j
173 173 searching for changes
174 174 abort: push creates new remote branches: b!
175 175 (use 'hg push -f' to force)
176 176
177 177 % prepush -r should not allow you to sneak in new heads
178 178 pushing to ../l
179 179 searching for changes
180 180 abort: push creates new remote heads on branch 'a'!
181 181 (did you forget to merge? use push -f to force)
182 182 % check prepush with new branch head on former topo non-head
183 183 marked working directory as branch A
184 184 adding a
185 185 marked working directory as branch B
186 186 adding b
187 187 updating to branch B
188 188 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 189 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 190 adding b1
191 191 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
192 192 adding a2
193 193 created new head
194 194 %% glog of local
195 195 @ 2: A a2
196 196 |
197 197 | o 1: B b
198 198 |/
199 199 o 0: A a
200 200
201 201 %% glog of remote
202 202 @ 2: B b1
203 203 |
204 204 o 1: B b
205 205 |
206 206 o 0: A a
207 207
208 208 %% outgoing
209 209 comparing with inner
210 210 searching for changes
211 211 2: A a2
212 212 pushing to inner
213 213 searching for changes
214 214 note: unsynced remote changes!
215 215 adding changesets
216 216 adding manifests
217 217 adding file changes
218 218 added 1 changesets with 1 changes to 1 files (+1 heads)
219 219 % check prepush with new branch head on former topo head
220 220 marked working directory as branch A
221 221 adding a
222 222 marked working directory as branch B
223 223 adding b
224 224 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
225 225 adding a1
226 226 created new head
227 227 updating to branch A
228 228 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 229 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
230 230 adding b1
231 231 adding a2
232 232 %% glog of local
233 233 @ 3: A a2
234 234 |
235 235 o 2: A a1
236 236 |
237 237 | o 1: B b
238 238 |/
239 239 o 0: A a
240 240
241 241 %% glog of remote
242 242 @ 3: B b1
243 243 |
244 244 | o 2: A a1
245 245 | |
246 246 o | 1: B b
247 247 |/
248 248 o 0: A a
249 249
250 250 %% outgoing
251 251 comparing with inner
252 252 searching for changes
253 253 3: A a2
254 254 pushing to inner
255 255 searching for changes
256 256 note: unsynced remote changes!
257 257 adding changesets
258 258 adding manifests
259 259 adding file changes
260 260 added 1 changesets with 1 changes to 1 files
261 % check prepush with new branch head and new child of former branch head
262 % but child is on different branch
263 marked working directory as branch A
264 adding a
265 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
266 marked working directory as branch B
267 adding b
268 created new head
269 updating to branch B
270 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
272 marked working directory as branch B
273 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
274 marked working directory as branch A
275 %% glog of local
276 @ 5: A b3
277 |
278 | o 4: B a3
279 | |
280 o | 3: B b1
281 | |
282 o | 2: B b0
283 /
284 o 1: A a1
285 |
286 o 0: A a0
287
288 %% glog of remote
289 @ 3: B b1
290 |
291 o 2: B b0
292
293 o 1: A a1
294 |
295 o 0: A a0
296
297 %% outgoing
298 comparing with inner
299 searching for changes
300 4: B a3
301 5: A b3
302 pushing to inner
303 searching for changes
304 abort: push creates new remote heads on branch 'A'!
305 (did you forget to merge? use push -f to force)
General Comments 0
You need to be logged in to leave comments. Login now