Show More
@@ -1,661 +1,661 b'' | |||
|
1 | 1 | $ hg init |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | committing changes |
|
5 | 5 | |
|
6 | 6 | $ count=0 |
|
7 | 7 | $ echo > a |
|
8 | 8 | $ while test $count -lt 32 ; do |
|
9 | 9 | > echo 'a' >> a |
|
10 | 10 | > test $count -eq 0 && hg add |
|
11 | 11 | > hg ci -m "msg $count" -d "$count 0" |
|
12 | 12 | > count=`expr $count + 1` |
|
13 | 13 | > done |
|
14 | 14 | adding a |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | $ hg log |
|
18 | 18 | changeset: 31:58c80a7c8a40 |
|
19 | 19 | tag: tip |
|
20 | 20 | user: test |
|
21 | 21 | date: Thu Jan 01 00:00:31 1970 +0000 |
|
22 | 22 | summary: msg 31 |
|
23 | 23 | |
|
24 | 24 | changeset: 30:ed2d2f24b11c |
|
25 | 25 | user: test |
|
26 | 26 | date: Thu Jan 01 00:00:30 1970 +0000 |
|
27 | 27 | summary: msg 30 |
|
28 | 28 | |
|
29 | 29 | changeset: 29:b5bd63375ab9 |
|
30 | 30 | user: test |
|
31 | 31 | date: Thu Jan 01 00:00:29 1970 +0000 |
|
32 | 32 | summary: msg 29 |
|
33 | 33 | |
|
34 | 34 | changeset: 28:8e0c2264c8af |
|
35 | 35 | user: test |
|
36 | 36 | date: Thu Jan 01 00:00:28 1970 +0000 |
|
37 | 37 | summary: msg 28 |
|
38 | 38 | |
|
39 | 39 | changeset: 27:288867a866e9 |
|
40 | 40 | user: test |
|
41 | 41 | date: Thu Jan 01 00:00:27 1970 +0000 |
|
42 | 42 | summary: msg 27 |
|
43 | 43 | |
|
44 | 44 | changeset: 26:3efc6fd51aeb |
|
45 | 45 | user: test |
|
46 | 46 | date: Thu Jan 01 00:00:26 1970 +0000 |
|
47 | 47 | summary: msg 26 |
|
48 | 48 | |
|
49 | 49 | changeset: 25:02a84173a97a |
|
50 | 50 | user: test |
|
51 | 51 | date: Thu Jan 01 00:00:25 1970 +0000 |
|
52 | 52 | summary: msg 25 |
|
53 | 53 | |
|
54 | 54 | changeset: 24:10e0acd3809e |
|
55 | 55 | user: test |
|
56 | 56 | date: Thu Jan 01 00:00:24 1970 +0000 |
|
57 | 57 | summary: msg 24 |
|
58 | 58 | |
|
59 | 59 | changeset: 23:5ec79163bff4 |
|
60 | 60 | user: test |
|
61 | 61 | date: Thu Jan 01 00:00:23 1970 +0000 |
|
62 | 62 | summary: msg 23 |
|
63 | 63 | |
|
64 | 64 | changeset: 22:06c7993750ce |
|
65 | 65 | user: test |
|
66 | 66 | date: Thu Jan 01 00:00:22 1970 +0000 |
|
67 | 67 | summary: msg 22 |
|
68 | 68 | |
|
69 | 69 | changeset: 21:e5db6aa3fe2a |
|
70 | 70 | user: test |
|
71 | 71 | date: Thu Jan 01 00:00:21 1970 +0000 |
|
72 | 72 | summary: msg 21 |
|
73 | 73 | |
|
74 | 74 | changeset: 20:7128fb4fdbc9 |
|
75 | 75 | user: test |
|
76 | 76 | date: Thu Jan 01 00:00:20 1970 +0000 |
|
77 | 77 | summary: msg 20 |
|
78 | 78 | |
|
79 | 79 | changeset: 19:52798545b482 |
|
80 | 80 | user: test |
|
81 | 81 | date: Thu Jan 01 00:00:19 1970 +0000 |
|
82 | 82 | summary: msg 19 |
|
83 | 83 | |
|
84 | 84 | changeset: 18:86977a90077e |
|
85 | 85 | user: test |
|
86 | 86 | date: Thu Jan 01 00:00:18 1970 +0000 |
|
87 | 87 | summary: msg 18 |
|
88 | 88 | |
|
89 | 89 | changeset: 17:03515f4a9080 |
|
90 | 90 | user: test |
|
91 | 91 | date: Thu Jan 01 00:00:17 1970 +0000 |
|
92 | 92 | summary: msg 17 |
|
93 | 93 | |
|
94 | 94 | changeset: 16:a2e6ea4973e9 |
|
95 | 95 | user: test |
|
96 | 96 | date: Thu Jan 01 00:00:16 1970 +0000 |
|
97 | 97 | summary: msg 16 |
|
98 | 98 | |
|
99 | 99 | changeset: 15:e7fa0811edb0 |
|
100 | 100 | user: test |
|
101 | 101 | date: Thu Jan 01 00:00:15 1970 +0000 |
|
102 | 102 | summary: msg 15 |
|
103 | 103 | |
|
104 | 104 | changeset: 14:ce8f0998e922 |
|
105 | 105 | user: test |
|
106 | 106 | date: Thu Jan 01 00:00:14 1970 +0000 |
|
107 | 107 | summary: msg 14 |
|
108 | 108 | |
|
109 | 109 | changeset: 13:9d7d07bc967c |
|
110 | 110 | user: test |
|
111 | 111 | date: Thu Jan 01 00:00:13 1970 +0000 |
|
112 | 112 | summary: msg 13 |
|
113 | 113 | |
|
114 | 114 | changeset: 12:1941b52820a5 |
|
115 | 115 | user: test |
|
116 | 116 | date: Thu Jan 01 00:00:12 1970 +0000 |
|
117 | 117 | summary: msg 12 |
|
118 | 118 | |
|
119 | 119 | changeset: 11:7b4cd9578619 |
|
120 | 120 | user: test |
|
121 | 121 | date: Thu Jan 01 00:00:11 1970 +0000 |
|
122 | 122 | summary: msg 11 |
|
123 | 123 | |
|
124 | 124 | changeset: 10:7c5eff49a6b6 |
|
125 | 125 | user: test |
|
126 | 126 | date: Thu Jan 01 00:00:10 1970 +0000 |
|
127 | 127 | summary: msg 10 |
|
128 | 128 | |
|
129 | 129 | changeset: 9:eb44510ef29a |
|
130 | 130 | user: test |
|
131 | 131 | date: Thu Jan 01 00:00:09 1970 +0000 |
|
132 | 132 | summary: msg 9 |
|
133 | 133 | |
|
134 | 134 | changeset: 8:453eb4dba229 |
|
135 | 135 | user: test |
|
136 | 136 | date: Thu Jan 01 00:00:08 1970 +0000 |
|
137 | 137 | summary: msg 8 |
|
138 | 138 | |
|
139 | 139 | changeset: 7:03750880c6b5 |
|
140 | 140 | user: test |
|
141 | 141 | date: Thu Jan 01 00:00:07 1970 +0000 |
|
142 | 142 | summary: msg 7 |
|
143 | 143 | |
|
144 | 144 | changeset: 6:a3d5c6fdf0d3 |
|
145 | 145 | user: test |
|
146 | 146 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
147 | 147 | summary: msg 6 |
|
148 | 148 | |
|
149 | 149 | changeset: 5:7874a09ea728 |
|
150 | 150 | user: test |
|
151 | 151 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
152 | 152 | summary: msg 5 |
|
153 | 153 | |
|
154 | 154 | changeset: 4:9b2ba8336a65 |
|
155 | 155 | user: test |
|
156 | 156 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
157 | 157 | summary: msg 4 |
|
158 | 158 | |
|
159 | 159 | changeset: 3:b53bea5e2fcb |
|
160 | 160 | user: test |
|
161 | 161 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
162 | 162 | summary: msg 3 |
|
163 | 163 | |
|
164 | 164 | changeset: 2:db07c04beaca |
|
165 | 165 | user: test |
|
166 | 166 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
167 | 167 | summary: msg 2 |
|
168 | 168 | |
|
169 | 169 | changeset: 1:5cd978ea5149 |
|
170 | 170 | user: test |
|
171 | 171 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
172 | 172 | summary: msg 1 |
|
173 | 173 | |
|
174 | 174 | changeset: 0:b99c7b9c8e11 |
|
175 | 175 | user: test |
|
176 | 176 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
177 | 177 | summary: msg 0 |
|
178 | 178 | |
|
179 | 179 | |
|
180 | 180 | $ hg up -C |
|
181 | 181 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
182 | 182 | |
|
183 | 183 | bisect test |
|
184 | 184 | |
|
185 | 185 | $ hg bisect -r |
|
186 | 186 | $ hg bisect -b |
|
187 | 187 | $ hg summary |
|
188 | 188 | parent: 31:58c80a7c8a40 tip |
|
189 | 189 | msg 31 |
|
190 | 190 | branch: default |
|
191 | 191 | commit: (clean) |
|
192 | 192 | update: (current) |
|
193 | 193 | phases: 32 draft |
|
194 | 194 | $ hg bisect -g 1 |
|
195 | 195 | Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests) |
|
196 | 196 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
197 | 197 | $ hg bisect -g |
|
198 | 198 | Testing changeset 23:5ec79163bff4 (15 changesets remaining, ~3 tests) |
|
199 | 199 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
200 | 200 | |
|
201 | 201 | skip |
|
202 | 202 | |
|
203 | 203 | $ hg bisect -s |
|
204 | 204 | Testing changeset 24:10e0acd3809e (15 changesets remaining, ~3 tests) |
|
205 | 205 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
206 | 206 | $ hg bisect -g |
|
207 | 207 | Testing changeset 27:288867a866e9 (7 changesets remaining, ~2 tests) |
|
208 | 208 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
209 | 209 | $ hg bisect -g |
|
210 | 210 | Testing changeset 29:b5bd63375ab9 (4 changesets remaining, ~2 tests) |
|
211 | 211 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
212 | 212 | $ hg bisect -b |
|
213 | 213 | Testing changeset 28:8e0c2264c8af (2 changesets remaining, ~1 tests) |
|
214 | 214 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
215 | 215 | $ hg bisect -g |
|
216 | 216 | The first bad revision is: |
|
217 | 217 | changeset: 29:b5bd63375ab9 |
|
218 | 218 | user: test |
|
219 | 219 | date: Thu Jan 01 00:00:29 1970 +0000 |
|
220 | 220 | summary: msg 29 |
|
221 | 221 | |
|
222 | 222 | |
|
223 | 223 | mark revsets instead of single revs |
|
224 | 224 | |
|
225 | 225 | $ hg bisect -r |
|
226 | 226 | $ hg bisect -b "0::3" |
|
227 | 227 | $ hg bisect -s "13::16" |
|
228 | 228 | $ hg bisect -g "26::tip" |
|
229 | 229 | Testing changeset 12:1941b52820a5 (23 changesets remaining, ~4 tests) |
|
230 | 230 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
231 | 231 | $ cat .hg/bisect.state |
|
232 | 232 | bad b99c7b9c8e11558adef3fad9af211c58d46f325b |
|
233 | 233 | bad 5cd978ea51499179507ee7b6f340d2dbaa401185 |
|
234 | 234 | bad db07c04beaca44cf24832541e7f4a2346a95275b |
|
235 | 235 | bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b |
|
236 | 236 | current 1941b52820a544549596820a8ae006842b0e2c64 |
|
237 | 237 | good 3efc6fd51aeb8594398044c6c846ca59ae021203 |
|
238 | 238 | good 288867a866e9adb7a29880b66936c874b80f4651 |
|
239 | 239 | good 8e0c2264c8af790daf3585ada0669d93dee09c83 |
|
240 | 240 | good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8 |
|
241 | 241 | good ed2d2f24b11c368fa8aa0da9f4e1db580abade59 |
|
242 | 242 | good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96 |
|
243 | 243 | skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991 |
|
244 | 244 | skip ce8f0998e922c179e80819d5066fbe46e2998784 |
|
245 | 245 | skip e7fa0811edb063f6319531f0d0a865882138e180 |
|
246 | 246 | skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3 |
|
247 | 247 | |
|
248 | 248 | bisect reverse test |
|
249 | 249 | |
|
250 | 250 | $ hg bisect -r |
|
251 | 251 | $ hg bisect -b null |
|
252 | 252 | $ hg bisect -g tip |
|
253 | 253 | Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests) |
|
254 | 254 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
255 | 255 | $ hg bisect -g |
|
256 | 256 | Testing changeset 7:03750880c6b5 (16 changesets remaining, ~4 tests) |
|
257 | 257 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
258 | 258 | |
|
259 | 259 | skip |
|
260 | 260 | |
|
261 | 261 | $ hg bisect -s |
|
262 | 262 | Testing changeset 6:a3d5c6fdf0d3 (16 changesets remaining, ~4 tests) |
|
263 | 263 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
264 | 264 | $ hg bisect -g |
|
265 | 265 | Testing changeset 2:db07c04beaca (7 changesets remaining, ~2 tests) |
|
266 | 266 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
267 | 267 | $ hg bisect -g |
|
268 | 268 | Testing changeset 0:b99c7b9c8e11 (3 changesets remaining, ~1 tests) |
|
269 | 269 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
270 | 270 | $ hg bisect -b |
|
271 | 271 | Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests) |
|
272 | 272 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
273 | 273 | $ hg bisect -g |
|
274 | 274 | The first good revision is: |
|
275 | 275 | changeset: 1:5cd978ea5149 |
|
276 | 276 | user: test |
|
277 | 277 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
278 | 278 | summary: msg 1 |
|
279 | 279 | |
|
280 | 280 | |
|
281 | 281 | $ hg bisect -r |
|
282 | 282 | $ hg bisect -g tip |
|
283 | 283 | $ hg bisect -b tip |
|
284 | 284 | abort: inconsistent state, 31:58c80a7c8a40 is good and bad |
|
285 | 285 | [255] |
|
286 | 286 | |
|
287 | 287 | $ hg bisect -r |
|
288 | 288 | $ hg bisect -g null |
|
289 | 289 | $ hg bisect -bU tip |
|
290 | 290 | Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests) |
|
291 | 291 | $ hg id |
|
292 | 292 | 5cd978ea5149 |
|
293 | 293 | |
|
294 | 294 | |
|
295 | 295 | Issue1228: hg bisect crashes when you skip the last rev in bisection |
|
296 | 296 | Issue1182: hg bisect exception |
|
297 | 297 | |
|
298 | 298 | $ hg bisect -r |
|
299 | 299 | $ hg bisect -b 4 |
|
300 | 300 | $ hg bisect -g 0 |
|
301 | 301 | Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests) |
|
302 | 302 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
303 | 303 | $ hg bisect -s |
|
304 | 304 | Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests) |
|
305 | 305 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
306 | 306 | $ hg bisect -s |
|
307 | 307 | Testing changeset 3:b53bea5e2fcb (4 changesets remaining, ~2 tests) |
|
308 | 308 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
309 | 309 | $ hg bisect -s |
|
310 | 310 | Due to skipped revisions, the first bad revision could be any of: |
|
311 | 311 | changeset: 1:5cd978ea5149 |
|
312 | 312 | user: test |
|
313 | 313 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
314 | 314 | summary: msg 1 |
|
315 | 315 | |
|
316 | 316 | changeset: 2:db07c04beaca |
|
317 | 317 | user: test |
|
318 | 318 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
319 | 319 | summary: msg 2 |
|
320 | 320 | |
|
321 | 321 | changeset: 3:b53bea5e2fcb |
|
322 | 322 | user: test |
|
323 | 323 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
324 | 324 | summary: msg 3 |
|
325 | 325 | |
|
326 | 326 | changeset: 4:9b2ba8336a65 |
|
327 | 327 | user: test |
|
328 | 328 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
329 | 329 | summary: msg 4 |
|
330 | 330 | |
|
331 | 331 | |
|
332 | 332 | |
|
333 | 333 | reproduce non converging bisect, issue1182 |
|
334 | 334 | |
|
335 | 335 | $ hg bisect -r |
|
336 | 336 | $ hg bisect -g 0 |
|
337 | 337 | $ hg bisect -b 2 |
|
338 | 338 | Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests) |
|
339 | 339 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
340 | 340 | $ hg bisect -s |
|
341 | 341 | Due to skipped revisions, the first bad revision could be any of: |
|
342 | 342 | changeset: 1:5cd978ea5149 |
|
343 | 343 | user: test |
|
344 | 344 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
345 | 345 | summary: msg 1 |
|
346 | 346 | |
|
347 | 347 | changeset: 2:db07c04beaca |
|
348 | 348 | user: test |
|
349 | 349 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
350 | 350 | summary: msg 2 |
|
351 | 351 | |
|
352 | 352 | |
|
353 | 353 | |
|
354 | 354 | test no action |
|
355 | 355 | |
|
356 | 356 | $ hg bisect -r |
|
357 | 357 | $ hg bisect |
|
358 | 358 | abort: cannot bisect (no known good revisions) |
|
359 | 359 | [255] |
|
360 | 360 | |
|
361 | 361 | |
|
362 | 362 | reproduce AssertionError, issue1445 |
|
363 | 363 | |
|
364 | 364 | $ hg bisect -r |
|
365 | 365 | $ hg bisect -b 6 |
|
366 | 366 | $ hg bisect -g 0 |
|
367 | 367 | Testing changeset 3:b53bea5e2fcb (6 changesets remaining, ~2 tests) |
|
368 | 368 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
369 | 369 | $ hg bisect -s |
|
370 | 370 | Testing changeset 2:db07c04beaca (6 changesets remaining, ~2 tests) |
|
371 | 371 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
372 | 372 | $ hg bisect -s |
|
373 | 373 | Testing changeset 4:9b2ba8336a65 (6 changesets remaining, ~2 tests) |
|
374 | 374 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
375 | 375 | $ hg bisect -s |
|
376 | 376 | Testing changeset 1:5cd978ea5149 (6 changesets remaining, ~2 tests) |
|
377 | 377 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
378 | 378 | $ hg bisect -s |
|
379 | 379 | Testing changeset 5:7874a09ea728 (6 changesets remaining, ~2 tests) |
|
380 | 380 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
381 | 381 | $ hg bisect -g |
|
382 | 382 | The first bad revision is: |
|
383 | 383 | changeset: 6:a3d5c6fdf0d3 |
|
384 | 384 | user: test |
|
385 | 385 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
386 | 386 | summary: msg 6 |
|
387 | 387 | |
|
388 | 388 | $ hg log -r "bisect(good)" |
|
389 | 389 | changeset: 0:b99c7b9c8e11 |
|
390 | 390 | user: test |
|
391 | 391 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
392 | 392 | summary: msg 0 |
|
393 | 393 | |
|
394 | 394 | changeset: 5:7874a09ea728 |
|
395 | 395 | user: test |
|
396 | 396 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
397 | 397 | summary: msg 5 |
|
398 | 398 | |
|
399 | 399 | $ hg log -r "bisect(bad)" |
|
400 | 400 | changeset: 6:a3d5c6fdf0d3 |
|
401 | 401 | user: test |
|
402 | 402 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
403 | 403 | summary: msg 6 |
|
404 | 404 | |
|
405 | 405 | $ hg log -r "bisect(current)" |
|
406 | 406 | changeset: 5:7874a09ea728 |
|
407 | 407 | user: test |
|
408 | 408 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
409 | 409 | summary: msg 5 |
|
410 | 410 | |
|
411 | 411 | $ hg log -r "bisect(skip)" |
|
412 | 412 | changeset: 1:5cd978ea5149 |
|
413 | 413 | user: test |
|
414 | 414 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
415 | 415 | summary: msg 1 |
|
416 | 416 | |
|
417 | 417 | changeset: 2:db07c04beaca |
|
418 | 418 | user: test |
|
419 | 419 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
420 | 420 | summary: msg 2 |
|
421 | 421 | |
|
422 | 422 | changeset: 3:b53bea5e2fcb |
|
423 | 423 | user: test |
|
424 | 424 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
425 | 425 | summary: msg 3 |
|
426 | 426 | |
|
427 | 427 | changeset: 4:9b2ba8336a65 |
|
428 | 428 | user: test |
|
429 | 429 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
430 | 430 | summary: msg 4 |
|
431 | 431 | |
|
432 | 432 | |
|
433 | 433 | test legacy bisected() keyword |
|
434 | 434 | |
|
435 | 435 | $ hg log -r "bisected(bad)" |
|
436 | 436 | changeset: 6:a3d5c6fdf0d3 |
|
437 | 437 | user: test |
|
438 | 438 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
439 | 439 | summary: msg 6 |
|
440 | 440 | |
|
441 | 441 | |
|
442 | 442 | $ set +e |
|
443 | 443 | |
|
444 | 444 | test invalid command |
|
445 | 445 | assuming that the shell returns 127 if command not found ... |
|
446 | 446 | |
|
447 | 447 | $ hg bisect -r |
|
448 | 448 | $ hg bisect --command 'exit 127' |
|
449 | 449 | abort: failed to execute exit 127 |
|
450 | 450 | [255] |
|
451 | 451 | |
|
452 | 452 | |
|
453 | 453 | test bisecting command |
|
454 | 454 | |
|
455 | 455 | $ cat > script.py <<EOF |
|
456 | 456 | > #!$PYTHON |
|
457 | 457 | > import sys |
|
458 | 458 | > from mercurial import ui, hg |
|
459 | 459 | > repo = hg.repository(ui.ui.load(), '.') |
|
460 | 460 | > if repo['.'].rev() < 6: |
|
461 | 461 | > sys.exit(1) |
|
462 | 462 | > EOF |
|
463 | 463 | $ chmod +x script.py |
|
464 | 464 | $ hg bisect -r |
|
465 | 465 | $ hg up -qr tip |
|
466 | $ hg bisect --command "$PYTHON \"$TESTTMP/script.py\" and some parameters" | |
|
466 | $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters" | |
|
467 | 467 | changeset 31:58c80a7c8a40: good |
|
468 | 468 | abort: cannot bisect (no known bad revisions) |
|
469 | 469 | [255] |
|
470 | 470 | $ hg up -qr 0 |
|
471 | $ hg bisect --command "$PYTHON \"$TESTTMP/script.py\" and some parameters" | |
|
471 | $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters" | |
|
472 | 472 | changeset 0:b99c7b9c8e11: bad |
|
473 | 473 | changeset 15:e7fa0811edb0: good |
|
474 | 474 | changeset 7:03750880c6b5: good |
|
475 | 475 | changeset 3:b53bea5e2fcb: bad |
|
476 | 476 | changeset 5:7874a09ea728: bad |
|
477 | 477 | changeset 6:a3d5c6fdf0d3: good |
|
478 | 478 | The first good revision is: |
|
479 | 479 | changeset: 6:a3d5c6fdf0d3 |
|
480 | 480 | user: test |
|
481 | 481 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
482 | 482 | summary: msg 6 |
|
483 | 483 | |
|
484 | 484 | |
|
485 | 485 | |
|
486 | 486 | test bisecting via a command without updating the working dir, and |
|
487 | 487 | ensure that the bisect state file is updated before running a test |
|
488 | 488 | command |
|
489 | 489 | |
|
490 | 490 | $ hg update null |
|
491 | 491 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
492 | 492 | $ cat > script.sh <<'EOF' |
|
493 | 493 | > #!/bin/sh |
|
494 | 494 | > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127) |
|
495 | 495 | > current="`hg log -r \"bisect(current)\" --template {node}`" |
|
496 | 496 | > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127) |
|
497 | 497 | > rev="`hg log -r $HG_NODE --template {rev}`" |
|
498 | 498 | > test "$rev" -ge 6 |
|
499 | 499 | > EOF |
|
500 | 500 | $ chmod +x script.sh |
|
501 | 501 | $ hg bisect -r |
|
502 | 502 | $ hg bisect --good tip --noupdate |
|
503 | 503 | $ hg bisect --bad 0 --noupdate |
|
504 | 504 | Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests) |
|
505 | 505 | $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate |
|
506 | 506 | changeset 15:e7fa0811edb0: good |
|
507 | 507 | changeset 7:03750880c6b5: good |
|
508 | 508 | changeset 3:b53bea5e2fcb: bad |
|
509 | 509 | changeset 5:7874a09ea728: bad |
|
510 | 510 | changeset 6:a3d5c6fdf0d3: good |
|
511 | 511 | The first good revision is: |
|
512 | 512 | changeset: 6:a3d5c6fdf0d3 |
|
513 | 513 | user: test |
|
514 | 514 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
515 | 515 | summary: msg 6 |
|
516 | 516 | |
|
517 | 517 | |
|
518 | 518 | ensure that we still don't have a working dir |
|
519 | 519 | |
|
520 | 520 | $ hg parents |
|
521 | 521 | |
|
522 | 522 | |
|
523 | 523 | test the same case, this time with updating |
|
524 | 524 | |
|
525 | 525 | $ cat > script.sh <<'EOF' |
|
526 | 526 | > #!/bin/sh |
|
527 | 527 | > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127) |
|
528 | 528 | > current="`hg log -r \"bisect(current)\" --template {node}`" |
|
529 | 529 | > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127) |
|
530 | 530 | > rev="`hg log -r . --template {rev}`" |
|
531 | 531 | > test "$rev" -ge 6 |
|
532 | 532 | > EOF |
|
533 | 533 | $ chmod +x script.sh |
|
534 | 534 | $ hg bisect -r |
|
535 | 535 | $ hg up -qr tip |
|
536 | 536 | $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" |
|
537 | 537 | changeset 31:58c80a7c8a40: good |
|
538 | 538 | abort: cannot bisect (no known bad revisions) |
|
539 | 539 | [255] |
|
540 | 540 | $ hg up -qr 0 |
|
541 | 541 | $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" |
|
542 | 542 | changeset 0:b99c7b9c8e11: bad |
|
543 | 543 | changeset 15:e7fa0811edb0: good |
|
544 | 544 | changeset 7:03750880c6b5: good |
|
545 | 545 | changeset 3:b53bea5e2fcb: bad |
|
546 | 546 | changeset 5:7874a09ea728: bad |
|
547 | 547 | changeset 6:a3d5c6fdf0d3: good |
|
548 | 548 | The first good revision is: |
|
549 | 549 | changeset: 6:a3d5c6fdf0d3 |
|
550 | 550 | user: test |
|
551 | 551 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
552 | 552 | summary: msg 6 |
|
553 | 553 | |
|
554 | 554 | $ hg graft -q 15 |
|
555 | 555 | warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
|
556 | 556 | abort: unresolved conflicts, can't continue |
|
557 | 557 | (use 'hg resolve' and 'hg graft --continue') |
|
558 | 558 | [255] |
|
559 | 559 | $ hg bisect --reset |
|
560 | 560 | $ hg up -C . |
|
561 | 561 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
562 | 562 | |
|
563 | 563 | Check that bisect does not break on obsolete changesets |
|
564 | 564 | ========================================================= |
|
565 | 565 | |
|
566 | 566 | $ cat >> $HGRCPATH << EOF |
|
567 | 567 | > [experimental] |
|
568 | 568 | > evolution=createmarkers |
|
569 | 569 | > EOF |
|
570 | 570 | |
|
571 | 571 | tip is obsolete |
|
572 | 572 | --------------------- |
|
573 | 573 | |
|
574 | 574 | $ hg debugobsolete `hg id --debug -i -r tip` |
|
575 | 575 | $ hg bisect --reset |
|
576 | 576 | $ hg bisect --good 15 |
|
577 | 577 | $ hg bisect --bad 30 |
|
578 | 578 | Testing changeset 22:06c7993750ce (15 changesets remaining, ~3 tests) |
|
579 | 579 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
580 | 580 | $ hg bisect --command true |
|
581 | 581 | changeset 22:06c7993750ce: good |
|
582 | 582 | changeset 26:3efc6fd51aeb: good |
|
583 | 583 | changeset 28:8e0c2264c8af: good |
|
584 | 584 | changeset 29:b5bd63375ab9: good |
|
585 | 585 | The first bad revision is: |
|
586 | 586 | changeset: 30:ed2d2f24b11c |
|
587 | 587 | tag: tip |
|
588 | 588 | user: test |
|
589 | 589 | date: Thu Jan 01 00:00:30 1970 +0000 |
|
590 | 590 | summary: msg 30 |
|
591 | 591 | |
|
592 | 592 | |
|
593 | 593 | Changeset in the bad:good range is obsolete |
|
594 | 594 | --------------------------------------------- |
|
595 | 595 | |
|
596 | 596 | $ hg up 30 |
|
597 | 597 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
598 | 598 | $ echo 'a' >> a |
|
599 | 599 | $ hg ci -m "msg 32" -d "32 0" |
|
600 | 600 | $ hg bisect --reset |
|
601 | 601 | $ hg bisect --good . |
|
602 | 602 | $ hg bisect --bad 25 |
|
603 | 603 | Testing changeset 28:8e0c2264c8af (6 changesets remaining, ~2 tests) |
|
604 | 604 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
605 | 605 | $ hg bisect --command true |
|
606 | 606 | changeset 28:8e0c2264c8af: good |
|
607 | 607 | changeset 26:3efc6fd51aeb: good |
|
608 | 608 | The first good revision is: |
|
609 | 609 | changeset: 26:3efc6fd51aeb |
|
610 | 610 | user: test |
|
611 | 611 | date: Thu Jan 01 00:00:26 1970 +0000 |
|
612 | 612 | summary: msg 26 |
|
613 | 613 | |
|
614 | 614 | Test the validation message when exclusive options are used: |
|
615 | 615 | |
|
616 | 616 | $ hg bisect -r |
|
617 | 617 | $ hg bisect -b -c false |
|
618 | 618 | abort: --bad and --command are incompatible |
|
619 | 619 | [255] |
|
620 | 620 | $ hg bisect -b -e |
|
621 | 621 | abort: --bad and --extend are incompatible |
|
622 | 622 | [255] |
|
623 | 623 | $ hg bisect -b -g |
|
624 | 624 | abort: --bad and --good are incompatible |
|
625 | 625 | [255] |
|
626 | 626 | $ hg bisect -b -r |
|
627 | 627 | abort: --bad and --reset are incompatible |
|
628 | 628 | [255] |
|
629 | 629 | $ hg bisect -b -s |
|
630 | 630 | abort: --bad and --skip are incompatible |
|
631 | 631 | [255] |
|
632 | 632 | $ hg bisect -c false -e |
|
633 | 633 | abort: --command and --extend are incompatible |
|
634 | 634 | [255] |
|
635 | 635 | $ hg bisect -c false -g |
|
636 | 636 | abort: --command and --good are incompatible |
|
637 | 637 | [255] |
|
638 | 638 | $ hg bisect -c false -r |
|
639 | 639 | abort: --command and --reset are incompatible |
|
640 | 640 | [255] |
|
641 | 641 | $ hg bisect -c false -s |
|
642 | 642 | abort: --command and --skip are incompatible |
|
643 | 643 | [255] |
|
644 | 644 | $ hg bisect -e -g |
|
645 | 645 | abort: --extend and --good are incompatible |
|
646 | 646 | [255] |
|
647 | 647 | $ hg bisect -e -r |
|
648 | 648 | abort: --extend and --reset are incompatible |
|
649 | 649 | [255] |
|
650 | 650 | $ hg bisect -e -s |
|
651 | 651 | abort: --extend and --skip are incompatible |
|
652 | 652 | [255] |
|
653 | 653 | $ hg bisect -g -r |
|
654 | 654 | abort: --good and --reset are incompatible |
|
655 | 655 | [255] |
|
656 | 656 | $ hg bisect -g -s |
|
657 | 657 | abort: --good and --skip are incompatible |
|
658 | 658 | [255] |
|
659 | 659 | $ hg bisect -r -s |
|
660 | 660 | abort: --reset and --skip are incompatible |
|
661 | 661 | [255] |
@@ -1,1812 +1,1812 b'' | |||
|
1 | 1 | $ hg init a |
|
2 | 2 | $ mkdir a/d1 |
|
3 | 3 | $ mkdir a/d1/d2 |
|
4 | 4 | $ echo line 1 > a/a |
|
5 | 5 | $ echo line 1 > a/d1/d2/a |
|
6 | 6 | $ hg --cwd a ci -Ama |
|
7 | 7 | adding a |
|
8 | 8 | adding d1/d2/a |
|
9 | 9 | |
|
10 | 10 | $ echo line 2 >> a/a |
|
11 | 11 | $ hg --cwd a ci -u someone -d '1 0' -m'second change' |
|
12 | 12 | |
|
13 | 13 | import with no args: |
|
14 | 14 | |
|
15 | 15 | $ hg --cwd a import |
|
16 | 16 | abort: need at least one patch to import |
|
17 | 17 | [255] |
|
18 | 18 | |
|
19 | 19 | generate patches for the test |
|
20 | 20 | |
|
21 | 21 | $ hg --cwd a export tip > exported-tip.patch |
|
22 | 22 | $ hg --cwd a diff -r0:1 > diffed-tip.patch |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | import exported patch |
|
26 | 26 | (this also tests that editor is not invoked, if the patch contains the |
|
27 | 27 | commit message and '--edit' is not specified) |
|
28 | 28 | |
|
29 | 29 | $ hg clone -r0 a b |
|
30 | 30 | adding changesets |
|
31 | 31 | adding manifests |
|
32 | 32 | adding file changes |
|
33 | 33 | added 1 changesets with 2 changes to 2 files |
|
34 | 34 | updating to branch default |
|
35 | 35 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
36 | 36 | $ HGEDITOR=cat hg --cwd b import ../exported-tip.patch |
|
37 | 37 | applying ../exported-tip.patch |
|
38 | 38 | |
|
39 | 39 | message and committer and date should be same |
|
40 | 40 | |
|
41 | 41 | $ hg --cwd b tip |
|
42 | 42 | changeset: 1:1d4bd90af0e4 |
|
43 | 43 | tag: tip |
|
44 | 44 | user: someone |
|
45 | 45 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
46 | 46 | summary: second change |
|
47 | 47 | |
|
48 | 48 | $ rm -r b |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | import exported patch with external patcher |
|
52 | 52 | (this also tests that editor is invoked, if the '--edit' is specified, |
|
53 | 53 | regardless of the commit message in the patch) |
|
54 | 54 | |
|
55 | 55 | $ cat > dummypatch.py <<EOF |
|
56 | 56 | > from __future__ import print_function |
|
57 | 57 | > print('patching file a') |
|
58 | 58 | > file('a', 'wb').write('line2\n') |
|
59 | 59 | > EOF |
|
60 | 60 | $ hg clone -r0 a b |
|
61 | 61 | adding changesets |
|
62 | 62 | adding manifests |
|
63 | 63 | adding file changes |
|
64 | 64 | added 1 changesets with 2 changes to 2 files |
|
65 | 65 | updating to branch default |
|
66 | 66 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
67 |
$ HGEDITOR=cat hg --config ui.patch= |
|
|
67 | $ HGEDITOR=cat hg --config ui.patch="$PYTHON ../dummypatch.py" --cwd b import --edit ../exported-tip.patch | |
|
68 | 68 | applying ../exported-tip.patch |
|
69 | 69 | second change |
|
70 | 70 | |
|
71 | 71 | |
|
72 | 72 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
73 | 73 | HG: Leave message empty to abort commit. |
|
74 | 74 | HG: -- |
|
75 | 75 | HG: user: someone |
|
76 | 76 | HG: branch 'default' |
|
77 | 77 | HG: changed a |
|
78 | 78 | $ cat b/a |
|
79 | 79 | line2 |
|
80 | 80 | $ rm -r b |
|
81 | 81 | |
|
82 | 82 | |
|
83 | 83 | import of plain diff should fail without message |
|
84 | 84 | (this also tests that editor is invoked, if the patch doesn't contain |
|
85 | 85 | the commit message, regardless of '--edit') |
|
86 | 86 | |
|
87 | 87 | $ hg clone -r0 a b |
|
88 | 88 | adding changesets |
|
89 | 89 | adding manifests |
|
90 | 90 | adding file changes |
|
91 | 91 | added 1 changesets with 2 changes to 2 files |
|
92 | 92 | updating to branch default |
|
93 | 93 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
94 | 94 | $ cat > $TESTTMP/editor.sh <<EOF |
|
95 | 95 | > env | grep HGEDITFORM |
|
96 | 96 | > cat \$1 |
|
97 | 97 | > EOF |
|
98 | 98 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg --cwd b import ../diffed-tip.patch |
|
99 | 99 | applying ../diffed-tip.patch |
|
100 | 100 | HGEDITFORM=import.normal.normal |
|
101 | 101 | |
|
102 | 102 | |
|
103 | 103 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
104 | 104 | HG: Leave message empty to abort commit. |
|
105 | 105 | HG: -- |
|
106 | 106 | HG: user: test |
|
107 | 107 | HG: branch 'default' |
|
108 | 108 | HG: changed a |
|
109 | 109 | abort: empty commit message |
|
110 | 110 | [255] |
|
111 | 111 | |
|
112 | 112 | Test avoiding editor invocation at applying the patch with --exact, |
|
113 | 113 | even if commit message is empty |
|
114 | 114 | |
|
115 | 115 | $ echo a >> b/a |
|
116 | 116 | $ hg --cwd b commit -m ' ' |
|
117 | 117 | $ hg --cwd b tip -T "{node}\n" |
|
118 | 118 | d8804f3f5396d800812f579c8452796a5993bdb2 |
|
119 | 119 | $ hg --cwd b export -o ../empty-log.diff . |
|
120 | 120 | $ hg --cwd b update -q -C ".^1" |
|
121 | 121 | $ hg --cwd b --config extensions.strip= strip -q tip |
|
122 | 122 | $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff |
|
123 | 123 | applying ../empty-log.diff |
|
124 | 124 | $ hg --cwd b tip -T "{node}\n" |
|
125 | 125 | d8804f3f5396d800812f579c8452796a5993bdb2 |
|
126 | 126 | |
|
127 | 127 | $ rm -r b |
|
128 | 128 | |
|
129 | 129 | |
|
130 | 130 | import of plain diff should be ok with message |
|
131 | 131 | |
|
132 | 132 | $ hg clone -r0 a b |
|
133 | 133 | adding changesets |
|
134 | 134 | adding manifests |
|
135 | 135 | adding file changes |
|
136 | 136 | added 1 changesets with 2 changes to 2 files |
|
137 | 137 | updating to branch default |
|
138 | 138 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
139 | 139 | $ hg --cwd b import -mpatch ../diffed-tip.patch |
|
140 | 140 | applying ../diffed-tip.patch |
|
141 | 141 | $ rm -r b |
|
142 | 142 | |
|
143 | 143 | |
|
144 | 144 | import of plain diff with specific date and user |
|
145 | 145 | (this also tests that editor is not invoked, if |
|
146 | 146 | '--message'/'--logfile' is specified and '--edit' is not) |
|
147 | 147 | |
|
148 | 148 | $ hg clone -r0 a b |
|
149 | 149 | adding changesets |
|
150 | 150 | adding manifests |
|
151 | 151 | adding file changes |
|
152 | 152 | added 1 changesets with 2 changes to 2 files |
|
153 | 153 | updating to branch default |
|
154 | 154 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
155 | 155 | $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch |
|
156 | 156 | applying ../diffed-tip.patch |
|
157 | 157 | $ hg -R b tip -pv |
|
158 | 158 | changeset: 1:ca68f19f3a40 |
|
159 | 159 | tag: tip |
|
160 | 160 | user: user@nowhere.net |
|
161 | 161 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
162 | 162 | files: a |
|
163 | 163 | description: |
|
164 | 164 | patch |
|
165 | 165 | |
|
166 | 166 | |
|
167 | 167 | diff -r 80971e65b431 -r ca68f19f3a40 a |
|
168 | 168 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
169 | 169 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
170 | 170 | @@ -1,1 +1,2 @@ |
|
171 | 171 | line 1 |
|
172 | 172 | +line 2 |
|
173 | 173 | |
|
174 | 174 | $ rm -r b |
|
175 | 175 | |
|
176 | 176 | |
|
177 | 177 | import of plain diff should be ok with --no-commit |
|
178 | 178 | (this also tests that editor is not invoked, if '--no-commit' is |
|
179 | 179 | specified, regardless of '--edit') |
|
180 | 180 | |
|
181 | 181 | $ hg clone -r0 a b |
|
182 | 182 | adding changesets |
|
183 | 183 | adding manifests |
|
184 | 184 | adding file changes |
|
185 | 185 | added 1 changesets with 2 changes to 2 files |
|
186 | 186 | updating to branch default |
|
187 | 187 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
188 | 188 | $ HGEDITOR=cat hg --cwd b import --no-commit --edit ../diffed-tip.patch |
|
189 | 189 | applying ../diffed-tip.patch |
|
190 | 190 | $ hg --cwd b diff --nodates |
|
191 | 191 | diff -r 80971e65b431 a |
|
192 | 192 | --- a/a |
|
193 | 193 | +++ b/a |
|
194 | 194 | @@ -1,1 +1,2 @@ |
|
195 | 195 | line 1 |
|
196 | 196 | +line 2 |
|
197 | 197 | $ rm -r b |
|
198 | 198 | |
|
199 | 199 | |
|
200 | 200 | import of malformed plain diff should fail |
|
201 | 201 | |
|
202 | 202 | $ hg clone -r0 a b |
|
203 | 203 | adding changesets |
|
204 | 204 | adding manifests |
|
205 | 205 | adding file changes |
|
206 | 206 | added 1 changesets with 2 changes to 2 files |
|
207 | 207 | updating to branch default |
|
208 | 208 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
209 | 209 | $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch |
|
210 | 210 | $ hg --cwd b import -mpatch ../broken.patch |
|
211 | 211 | applying ../broken.patch |
|
212 | 212 | abort: bad hunk #1 |
|
213 | 213 | [255] |
|
214 | 214 | $ rm -r b |
|
215 | 215 | |
|
216 | 216 | |
|
217 | 217 | hg -R repo import |
|
218 | 218 | put the clone in a subdir - having a directory named "a" |
|
219 | 219 | used to hide a bug. |
|
220 | 220 | |
|
221 | 221 | $ mkdir dir |
|
222 | 222 | $ hg clone -r0 a dir/b |
|
223 | 223 | adding changesets |
|
224 | 224 | adding manifests |
|
225 | 225 | adding file changes |
|
226 | 226 | added 1 changesets with 2 changes to 2 files |
|
227 | 227 | updating to branch default |
|
228 | 228 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
229 | 229 | $ cd dir |
|
230 | 230 | $ hg -R b import ../exported-tip.patch |
|
231 | 231 | applying ../exported-tip.patch |
|
232 | 232 | $ cd .. |
|
233 | 233 | $ rm -r dir |
|
234 | 234 | |
|
235 | 235 | |
|
236 | 236 | import from stdin |
|
237 | 237 | |
|
238 | 238 | $ hg clone -r0 a b |
|
239 | 239 | adding changesets |
|
240 | 240 | adding manifests |
|
241 | 241 | adding file changes |
|
242 | 242 | added 1 changesets with 2 changes to 2 files |
|
243 | 243 | updating to branch default |
|
244 | 244 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
245 | 245 | $ hg --cwd b import - < exported-tip.patch |
|
246 | 246 | applying patch from stdin |
|
247 | 247 | $ rm -r b |
|
248 | 248 | |
|
249 | 249 | |
|
250 | 250 | import two patches in one stream |
|
251 | 251 | |
|
252 | 252 | $ hg init b |
|
253 | 253 | $ hg --cwd a export 0:tip | hg --cwd b import - |
|
254 | 254 | applying patch from stdin |
|
255 | 255 | $ hg --cwd a id |
|
256 | 256 | 1d4bd90af0e4 tip |
|
257 | 257 | $ hg --cwd b id |
|
258 | 258 | 1d4bd90af0e4 tip |
|
259 | 259 | $ rm -r b |
|
260 | 260 | |
|
261 | 261 | |
|
262 | 262 | override commit message |
|
263 | 263 | |
|
264 | 264 | $ hg clone -r0 a b |
|
265 | 265 | adding changesets |
|
266 | 266 | adding manifests |
|
267 | 267 | adding file changes |
|
268 | 268 | added 1 changesets with 2 changes to 2 files |
|
269 | 269 | updating to branch default |
|
270 | 270 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
271 | 271 | $ hg --cwd b import -m 'override' - < exported-tip.patch |
|
272 | 272 | applying patch from stdin |
|
273 | 273 | $ hg --cwd b tip | grep override |
|
274 | 274 | summary: override |
|
275 | 275 | $ rm -r b |
|
276 | 276 | |
|
277 | 277 | $ cat > mkmsg.py <<EOF |
|
278 | 278 | > import email.Message, sys |
|
279 | 279 | > msg = email.Message.Message() |
|
280 | 280 | > patch = open(sys.argv[1], 'rb').read() |
|
281 | 281 | > msg.set_payload('email commit message\n' + patch) |
|
282 | 282 | > msg['Subject'] = 'email patch' |
|
283 | 283 | > msg['From'] = 'email patcher' |
|
284 | 284 | > file(sys.argv[2], 'wb').write(msg.as_string()) |
|
285 | 285 | > EOF |
|
286 | 286 | |
|
287 | 287 | |
|
288 | 288 | plain diff in email, subject, message body |
|
289 | 289 | |
|
290 | 290 | $ hg clone -r0 a b |
|
291 | 291 | adding changesets |
|
292 | 292 | adding manifests |
|
293 | 293 | adding file changes |
|
294 | 294 | added 1 changesets with 2 changes to 2 files |
|
295 | 295 | updating to branch default |
|
296 | 296 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
297 | 297 | $ $PYTHON mkmsg.py diffed-tip.patch msg.patch |
|
298 | 298 | $ hg --cwd b import ../msg.patch |
|
299 | 299 | applying ../msg.patch |
|
300 | 300 | $ hg --cwd b tip | grep email |
|
301 | 301 | user: email patcher |
|
302 | 302 | summary: email patch |
|
303 | 303 | $ rm -r b |
|
304 | 304 | |
|
305 | 305 | |
|
306 | 306 | plain diff in email, no subject, message body |
|
307 | 307 | |
|
308 | 308 | $ hg clone -r0 a b |
|
309 | 309 | adding changesets |
|
310 | 310 | adding manifests |
|
311 | 311 | adding file changes |
|
312 | 312 | added 1 changesets with 2 changes to 2 files |
|
313 | 313 | updating to branch default |
|
314 | 314 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
315 | 315 | $ grep -v '^Subject:' msg.patch | hg --cwd b import - |
|
316 | 316 | applying patch from stdin |
|
317 | 317 | $ rm -r b |
|
318 | 318 | |
|
319 | 319 | |
|
320 | 320 | plain diff in email, subject, no message body |
|
321 | 321 | |
|
322 | 322 | $ hg clone -r0 a b |
|
323 | 323 | adding changesets |
|
324 | 324 | adding manifests |
|
325 | 325 | adding file changes |
|
326 | 326 | added 1 changesets with 2 changes to 2 files |
|
327 | 327 | updating to branch default |
|
328 | 328 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
329 | 329 | $ grep -v '^email ' msg.patch | hg --cwd b import - |
|
330 | 330 | applying patch from stdin |
|
331 | 331 | $ rm -r b |
|
332 | 332 | |
|
333 | 333 | |
|
334 | 334 | plain diff in email, no subject, no message body, should fail |
|
335 | 335 | |
|
336 | 336 | $ hg clone -r0 a b |
|
337 | 337 | adding changesets |
|
338 | 338 | adding manifests |
|
339 | 339 | adding file changes |
|
340 | 340 | added 1 changesets with 2 changes to 2 files |
|
341 | 341 | updating to branch default |
|
342 | 342 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
343 | 343 | $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - |
|
344 | 344 | applying patch from stdin |
|
345 | 345 | abort: empty commit message |
|
346 | 346 | [255] |
|
347 | 347 | $ rm -r b |
|
348 | 348 | |
|
349 | 349 | |
|
350 | 350 | hg export in email, should use patch header |
|
351 | 351 | |
|
352 | 352 | $ hg clone -r0 a b |
|
353 | 353 | adding changesets |
|
354 | 354 | adding manifests |
|
355 | 355 | adding file changes |
|
356 | 356 | added 1 changesets with 2 changes to 2 files |
|
357 | 357 | updating to branch default |
|
358 | 358 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
359 | 359 | $ $PYTHON mkmsg.py exported-tip.patch msg.patch |
|
360 | 360 | $ cat msg.patch | hg --cwd b import - |
|
361 | 361 | applying patch from stdin |
|
362 | 362 | $ hg --cwd b tip | grep second |
|
363 | 363 | summary: second change |
|
364 | 364 | $ rm -r b |
|
365 | 365 | |
|
366 | 366 | |
|
367 | 367 | subject: duplicate detection, removal of [PATCH] |
|
368 | 368 | The '---' tests the gitsendmail handling without proper mail headers |
|
369 | 369 | |
|
370 | 370 | $ cat > mkmsg2.py <<EOF |
|
371 | 371 | > import email.Message, sys |
|
372 | 372 | > msg = email.Message.Message() |
|
373 | 373 | > patch = open(sys.argv[1], 'rb').read() |
|
374 | 374 | > msg.set_payload('email patch\n\nnext line\n---\n' + patch) |
|
375 | 375 | > msg['Subject'] = '[PATCH] email patch' |
|
376 | 376 | > msg['From'] = 'email patcher' |
|
377 | 377 | > file(sys.argv[2], 'wb').write(msg.as_string()) |
|
378 | 378 | > EOF |
|
379 | 379 | |
|
380 | 380 | |
|
381 | 381 | plain diff in email, [PATCH] subject, message body with subject |
|
382 | 382 | |
|
383 | 383 | $ hg clone -r0 a b |
|
384 | 384 | adding changesets |
|
385 | 385 | adding manifests |
|
386 | 386 | adding file changes |
|
387 | 387 | added 1 changesets with 2 changes to 2 files |
|
388 | 388 | updating to branch default |
|
389 | 389 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
390 | 390 | $ $PYTHON mkmsg2.py diffed-tip.patch msg.patch |
|
391 | 391 | $ cat msg.patch | hg --cwd b import - |
|
392 | 392 | applying patch from stdin |
|
393 | 393 | $ hg --cwd b tip --template '{desc}\n' |
|
394 | 394 | email patch |
|
395 | 395 | |
|
396 | 396 | next line |
|
397 | 397 | $ rm -r b |
|
398 | 398 | |
|
399 | 399 | |
|
400 | 400 | Issue963: Parent of working dir incorrect after import of multiple |
|
401 | 401 | patches and rollback |
|
402 | 402 | |
|
403 | 403 | We weren't backing up the correct dirstate file when importing many |
|
404 | 404 | patches: import patch1 patch2; rollback |
|
405 | 405 | |
|
406 | 406 | $ echo line 3 >> a/a |
|
407 | 407 | $ hg --cwd a ci -m'third change' |
|
408 | 408 | $ hg --cwd a export -o '../patch%R' 1 2 |
|
409 | 409 | $ hg clone -qr0 a b |
|
410 | 410 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
411 | 411 | parent: 0 |
|
412 | 412 | $ hg --cwd b import -v ../patch1 ../patch2 |
|
413 | 413 | applying ../patch1 |
|
414 | 414 | patching file a |
|
415 | 415 | committing files: |
|
416 | 416 | a |
|
417 | 417 | committing manifest |
|
418 | 418 | committing changelog |
|
419 | 419 | created 1d4bd90af0e4 |
|
420 | 420 | applying ../patch2 |
|
421 | 421 | patching file a |
|
422 | 422 | committing files: |
|
423 | 423 | a |
|
424 | 424 | committing manifest |
|
425 | 425 | committing changelog |
|
426 | 426 | created 6d019af21222 |
|
427 | 427 | $ hg --cwd b rollback |
|
428 | 428 | repository tip rolled back to revision 0 (undo import) |
|
429 | 429 | working directory now based on revision 0 |
|
430 | 430 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
431 | 431 | parent: 0 |
|
432 | 432 | |
|
433 | 433 | Test that "hg rollback" doesn't restore dirstate to one at the |
|
434 | 434 | beginning of the rolled back transaction in not-"parent-gone" case. |
|
435 | 435 | |
|
436 | 436 | invoking pretxncommit hook will cause marking '.hg/dirstate' as a file |
|
437 | 437 | to be restored when rolling back, after DirstateTransactionPlan (see wiki |
|
438 | 438 | page for detail). |
|
439 | 439 | |
|
440 | 440 | $ hg --cwd b branch -q foobar |
|
441 | 441 | $ hg --cwd b commit -m foobar |
|
442 | 442 | $ hg --cwd b update 0 -q |
|
443 | 443 | $ hg --cwd b import ../patch1 ../patch2 --config hooks.pretxncommit=true |
|
444 | 444 | applying ../patch1 |
|
445 | 445 | applying ../patch2 |
|
446 | 446 | $ hg --cwd b update -q 1 |
|
447 | 447 | $ hg --cwd b rollback -q |
|
448 | 448 | $ hg --cwd b parents --template 'parent: {rev}\n' |
|
449 | 449 | parent: 1 |
|
450 | 450 | |
|
451 | 451 | $ hg --cwd b update -q -C 0 |
|
452 | 452 | $ hg --cwd b --config extensions.strip= strip -q 1 |
|
453 | 453 | |
|
454 | 454 | Test visibility of in-memory dirstate changes inside transaction to |
|
455 | 455 | external process |
|
456 | 456 | |
|
457 | 457 | $ echo foo > a/foo |
|
458 | 458 | $ hg --cwd a commit -A -m 'adding foo' foo |
|
459 | 459 | $ hg --cwd a export -o '../patch%R' 3 |
|
460 | 460 | |
|
461 | 461 | $ cat > $TESTTMP/checkvisibility.sh <<EOF |
|
462 | 462 | > echo "====" |
|
463 | 463 | > hg parents --template "VISIBLE {rev}:{node|short}\n" |
|
464 | 464 | > hg status -amr |
|
465 | 465 | > # test that pending changes are hidden |
|
466 | 466 | > unset HG_PENDING |
|
467 | 467 | > hg parents --template "ACTUAL {rev}:{node|short}\n" |
|
468 | 468 | > hg status -amr |
|
469 | 469 | > echo "====" |
|
470 | 470 | > EOF |
|
471 | 471 | |
|
472 | 472 | == test visibility to external editor |
|
473 | 473 | |
|
474 | 474 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
475 | 475 | ==== |
|
476 | 476 | VISIBLE 0:80971e65b431 |
|
477 | 477 | ACTUAL 0:80971e65b431 |
|
478 | 478 | ==== |
|
479 | 479 | |
|
480 | 480 | $ HGEDITOR="sh $TESTTMP/checkvisibility.sh" hg --cwd b import -v --edit ../patch1 ../patch2 ../patch3 |
|
481 | 481 | applying ../patch1 |
|
482 | 482 | patching file a |
|
483 | 483 | ==== |
|
484 | 484 | VISIBLE 0:80971e65b431 |
|
485 | 485 | M a |
|
486 | 486 | ACTUAL 0:80971e65b431 |
|
487 | 487 | M a |
|
488 | 488 | ==== |
|
489 | 489 | committing files: |
|
490 | 490 | a |
|
491 | 491 | committing manifest |
|
492 | 492 | committing changelog |
|
493 | 493 | created 1d4bd90af0e4 |
|
494 | 494 | applying ../patch2 |
|
495 | 495 | patching file a |
|
496 | 496 | ==== |
|
497 | 497 | VISIBLE 1:1d4bd90af0e4 |
|
498 | 498 | M a |
|
499 | 499 | ACTUAL 0:80971e65b431 |
|
500 | 500 | M a |
|
501 | 501 | ==== |
|
502 | 502 | committing files: |
|
503 | 503 | a |
|
504 | 504 | committing manifest |
|
505 | 505 | committing changelog |
|
506 | 506 | created 6d019af21222 |
|
507 | 507 | applying ../patch3 |
|
508 | 508 | patching file foo |
|
509 | 509 | adding foo |
|
510 | 510 | ==== |
|
511 | 511 | VISIBLE 2:6d019af21222 |
|
512 | 512 | A foo |
|
513 | 513 | ACTUAL 0:80971e65b431 |
|
514 | 514 | M a |
|
515 | 515 | ==== |
|
516 | 516 | committing files: |
|
517 | 517 | foo |
|
518 | 518 | committing manifest |
|
519 | 519 | committing changelog |
|
520 | 520 | created 55e3f75b2378 |
|
521 | 521 | |
|
522 | 522 | $ hg --cwd b rollback -q |
|
523 | 523 | |
|
524 | 524 | (content of file "a" is already changed and it should be recognized as |
|
525 | 525 | "M", even though dirstate is restored to one before "hg import") |
|
526 | 526 | |
|
527 | 527 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
528 | 528 | ==== |
|
529 | 529 | VISIBLE 0:80971e65b431 |
|
530 | 530 | M a |
|
531 | 531 | ACTUAL 0:80971e65b431 |
|
532 | 532 | M a |
|
533 | 533 | ==== |
|
534 | 534 | $ hg --cwd b revert --no-backup a |
|
535 | 535 | $ rm -f b/foo |
|
536 | 536 | |
|
537 | 537 | == test visibility to precommit external hook |
|
538 | 538 | |
|
539 | 539 | $ cat >> b/.hg/hgrc <<EOF |
|
540 | 540 | > [hooks] |
|
541 | 541 | > precommit.visibility = sh $TESTTMP/checkvisibility.sh |
|
542 | 542 | > EOF |
|
543 | 543 | |
|
544 | 544 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
545 | 545 | ==== |
|
546 | 546 | VISIBLE 0:80971e65b431 |
|
547 | 547 | ACTUAL 0:80971e65b431 |
|
548 | 548 | ==== |
|
549 | 549 | |
|
550 | 550 | $ hg --cwd b import ../patch1 ../patch2 ../patch3 |
|
551 | 551 | applying ../patch1 |
|
552 | 552 | ==== |
|
553 | 553 | VISIBLE 0:80971e65b431 |
|
554 | 554 | M a |
|
555 | 555 | ACTUAL 0:80971e65b431 |
|
556 | 556 | M a |
|
557 | 557 | ==== |
|
558 | 558 | applying ../patch2 |
|
559 | 559 | ==== |
|
560 | 560 | VISIBLE 1:1d4bd90af0e4 |
|
561 | 561 | M a |
|
562 | 562 | ACTUAL 0:80971e65b431 |
|
563 | 563 | M a |
|
564 | 564 | ==== |
|
565 | 565 | applying ../patch3 |
|
566 | 566 | ==== |
|
567 | 567 | VISIBLE 2:6d019af21222 |
|
568 | 568 | A foo |
|
569 | 569 | ACTUAL 0:80971e65b431 |
|
570 | 570 | M a |
|
571 | 571 | ==== |
|
572 | 572 | |
|
573 | 573 | $ hg --cwd b rollback -q |
|
574 | 574 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
575 | 575 | ==== |
|
576 | 576 | VISIBLE 0:80971e65b431 |
|
577 | 577 | M a |
|
578 | 578 | ACTUAL 0:80971e65b431 |
|
579 | 579 | M a |
|
580 | 580 | ==== |
|
581 | 581 | $ hg --cwd b revert --no-backup a |
|
582 | 582 | $ rm -f b/foo |
|
583 | 583 | |
|
584 | 584 | $ cat >> b/.hg/hgrc <<EOF |
|
585 | 585 | > [hooks] |
|
586 | 586 | > precommit.visibility = |
|
587 | 587 | > EOF |
|
588 | 588 | |
|
589 | 589 | == test visibility to pretxncommit external hook |
|
590 | 590 | |
|
591 | 591 | $ cat >> b/.hg/hgrc <<EOF |
|
592 | 592 | > [hooks] |
|
593 | 593 | > pretxncommit.visibility = sh $TESTTMP/checkvisibility.sh |
|
594 | 594 | > EOF |
|
595 | 595 | |
|
596 | 596 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
597 | 597 | ==== |
|
598 | 598 | VISIBLE 0:80971e65b431 |
|
599 | 599 | ACTUAL 0:80971e65b431 |
|
600 | 600 | ==== |
|
601 | 601 | |
|
602 | 602 | $ hg --cwd b import ../patch1 ../patch2 ../patch3 |
|
603 | 603 | applying ../patch1 |
|
604 | 604 | ==== |
|
605 | 605 | VISIBLE 0:80971e65b431 |
|
606 | 606 | M a |
|
607 | 607 | ACTUAL 0:80971e65b431 |
|
608 | 608 | M a |
|
609 | 609 | ==== |
|
610 | 610 | applying ../patch2 |
|
611 | 611 | ==== |
|
612 | 612 | VISIBLE 1:1d4bd90af0e4 |
|
613 | 613 | M a |
|
614 | 614 | ACTUAL 0:80971e65b431 |
|
615 | 615 | M a |
|
616 | 616 | ==== |
|
617 | 617 | applying ../patch3 |
|
618 | 618 | ==== |
|
619 | 619 | VISIBLE 2:6d019af21222 |
|
620 | 620 | A foo |
|
621 | 621 | ACTUAL 0:80971e65b431 |
|
622 | 622 | M a |
|
623 | 623 | ==== |
|
624 | 624 | |
|
625 | 625 | $ hg --cwd b rollback -q |
|
626 | 626 | $ (cd b && sh "$TESTTMP/checkvisibility.sh") |
|
627 | 627 | ==== |
|
628 | 628 | VISIBLE 0:80971e65b431 |
|
629 | 629 | M a |
|
630 | 630 | ACTUAL 0:80971e65b431 |
|
631 | 631 | M a |
|
632 | 632 | ==== |
|
633 | 633 | $ hg --cwd b revert --no-backup a |
|
634 | 634 | $ rm -f b/foo |
|
635 | 635 | |
|
636 | 636 | $ cat >> b/.hg/hgrc <<EOF |
|
637 | 637 | > [hooks] |
|
638 | 638 | > pretxncommit.visibility = |
|
639 | 639 | > EOF |
|
640 | 640 | |
|
641 | 641 | $ rm -r b |
|
642 | 642 | |
|
643 | 643 | |
|
644 | 644 | importing a patch in a subdirectory failed at the commit stage |
|
645 | 645 | |
|
646 | 646 | $ echo line 2 >> a/d1/d2/a |
|
647 | 647 | $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' |
|
648 | 648 | |
|
649 | 649 | hg import in a subdirectory |
|
650 | 650 | |
|
651 | 651 | $ hg clone -r0 a b |
|
652 | 652 | adding changesets |
|
653 | 653 | adding manifests |
|
654 | 654 | adding file changes |
|
655 | 655 | added 1 changesets with 2 changes to 2 files |
|
656 | 656 | updating to branch default |
|
657 | 657 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
658 | 658 | $ hg --cwd a export tip > tmp |
|
659 | 659 | $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch |
|
660 | 660 | $ dir=`pwd` |
|
661 | 661 | $ cd b/d1/d2 2>&1 > /dev/null |
|
662 | 662 | $ hg import ../../../subdir-tip.patch |
|
663 | 663 | applying ../../../subdir-tip.patch |
|
664 | 664 | $ cd "$dir" |
|
665 | 665 | |
|
666 | 666 | message should be 'subdir change' |
|
667 | 667 | committer should be 'someoneelse' |
|
668 | 668 | |
|
669 | 669 | $ hg --cwd b tip |
|
670 | 670 | changeset: 1:3577f5aea227 |
|
671 | 671 | tag: tip |
|
672 | 672 | user: someoneelse |
|
673 | 673 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
674 | 674 | summary: subdir change |
|
675 | 675 | |
|
676 | 676 | |
|
677 | 677 | should be empty |
|
678 | 678 | |
|
679 | 679 | $ hg --cwd b status |
|
680 | 680 | |
|
681 | 681 | |
|
682 | 682 | Test fuzziness (ambiguous patch location, fuzz=2) |
|
683 | 683 | |
|
684 | 684 | $ hg init fuzzy |
|
685 | 685 | $ cd fuzzy |
|
686 | 686 | $ echo line1 > a |
|
687 | 687 | $ echo line0 >> a |
|
688 | 688 | $ echo line3 >> a |
|
689 | 689 | $ hg ci -Am adda |
|
690 | 690 | adding a |
|
691 | 691 | $ echo line1 > a |
|
692 | 692 | $ echo line2 >> a |
|
693 | 693 | $ echo line0 >> a |
|
694 | 694 | $ echo line3 >> a |
|
695 | 695 | $ hg ci -m change a |
|
696 | 696 | $ hg export tip > fuzzy-tip.patch |
|
697 | 697 | $ hg up -C 0 |
|
698 | 698 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
699 | 699 | $ echo line1 > a |
|
700 | 700 | $ echo line0 >> a |
|
701 | 701 | $ echo line1 >> a |
|
702 | 702 | $ echo line0 >> a |
|
703 | 703 | $ hg ci -m brancha |
|
704 | 704 | created new head |
|
705 | 705 | $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch |
|
706 | 706 | applying fuzzy-tip.patch |
|
707 | 707 | patching file a |
|
708 | 708 | Hunk #1 FAILED at 0 |
|
709 | 709 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
710 | 710 | abort: patch failed to apply |
|
711 | 711 | [255] |
|
712 | 712 | $ hg import --no-commit -v fuzzy-tip.patch |
|
713 | 713 | applying fuzzy-tip.patch |
|
714 | 714 | patching file a |
|
715 | 715 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). |
|
716 | 716 | applied to working directory |
|
717 | 717 | $ hg revert -a |
|
718 | 718 | reverting a |
|
719 | 719 | |
|
720 | 720 | |
|
721 | 721 | import with --no-commit should have written .hg/last-message.txt |
|
722 | 722 | |
|
723 | 723 | $ cat .hg/last-message.txt |
|
724 | 724 | change (no-eol) |
|
725 | 725 | |
|
726 | 726 | |
|
727 | 727 | test fuzziness with eol=auto |
|
728 | 728 | |
|
729 | 729 | $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch |
|
730 | 730 | applying fuzzy-tip.patch |
|
731 | 731 | patching file a |
|
732 | 732 | Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines). |
|
733 | 733 | applied to working directory |
|
734 | 734 | $ cd .. |
|
735 | 735 | |
|
736 | 736 | |
|
737 | 737 | Test hunk touching empty files (issue906) |
|
738 | 738 | |
|
739 | 739 | $ hg init empty |
|
740 | 740 | $ cd empty |
|
741 | 741 | $ touch a |
|
742 | 742 | $ touch b1 |
|
743 | 743 | $ touch c1 |
|
744 | 744 | $ echo d > d |
|
745 | 745 | $ hg ci -Am init |
|
746 | 746 | adding a |
|
747 | 747 | adding b1 |
|
748 | 748 | adding c1 |
|
749 | 749 | adding d |
|
750 | 750 | $ echo a > a |
|
751 | 751 | $ echo b > b1 |
|
752 | 752 | $ hg mv b1 b2 |
|
753 | 753 | $ echo c > c1 |
|
754 | 754 | $ hg copy c1 c2 |
|
755 | 755 | $ rm d |
|
756 | 756 | $ touch d |
|
757 | 757 | $ hg diff --git |
|
758 | 758 | diff --git a/a b/a |
|
759 | 759 | --- a/a |
|
760 | 760 | +++ b/a |
|
761 | 761 | @@ -0,0 +1,1 @@ |
|
762 | 762 | +a |
|
763 | 763 | diff --git a/b1 b/b2 |
|
764 | 764 | rename from b1 |
|
765 | 765 | rename to b2 |
|
766 | 766 | --- a/b1 |
|
767 | 767 | +++ b/b2 |
|
768 | 768 | @@ -0,0 +1,1 @@ |
|
769 | 769 | +b |
|
770 | 770 | diff --git a/c1 b/c1 |
|
771 | 771 | --- a/c1 |
|
772 | 772 | +++ b/c1 |
|
773 | 773 | @@ -0,0 +1,1 @@ |
|
774 | 774 | +c |
|
775 | 775 | diff --git a/c1 b/c2 |
|
776 | 776 | copy from c1 |
|
777 | 777 | copy to c2 |
|
778 | 778 | --- a/c1 |
|
779 | 779 | +++ b/c2 |
|
780 | 780 | @@ -0,0 +1,1 @@ |
|
781 | 781 | +c |
|
782 | 782 | diff --git a/d b/d |
|
783 | 783 | --- a/d |
|
784 | 784 | +++ b/d |
|
785 | 785 | @@ -1,1 +0,0 @@ |
|
786 | 786 | -d |
|
787 | 787 | $ hg ci -m empty |
|
788 | 788 | $ hg export --git tip > empty.diff |
|
789 | 789 | $ hg up -C 0 |
|
790 | 790 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
791 | 791 | $ hg import empty.diff |
|
792 | 792 | applying empty.diff |
|
793 | 793 | $ for name in a b1 b2 c1 c2 d; do |
|
794 | 794 | > echo % $name file |
|
795 | 795 | > test -f $name && cat $name |
|
796 | 796 | > done |
|
797 | 797 | % a file |
|
798 | 798 | a |
|
799 | 799 | % b1 file |
|
800 | 800 | % b2 file |
|
801 | 801 | b |
|
802 | 802 | % c1 file |
|
803 | 803 | c |
|
804 | 804 | % c2 file |
|
805 | 805 | c |
|
806 | 806 | % d file |
|
807 | 807 | $ cd .. |
|
808 | 808 | |
|
809 | 809 | |
|
810 | 810 | Test importing a patch ending with a binary file removal |
|
811 | 811 | |
|
812 | 812 | $ hg init binaryremoval |
|
813 | 813 | $ cd binaryremoval |
|
814 | 814 | $ echo a > a |
|
815 | 815 | $ $PYTHON -c "file('b', 'wb').write('a\x00b')" |
|
816 | 816 | $ hg ci -Am addall |
|
817 | 817 | adding a |
|
818 | 818 | adding b |
|
819 | 819 | $ hg rm a |
|
820 | 820 | $ hg rm b |
|
821 | 821 | $ hg st |
|
822 | 822 | R a |
|
823 | 823 | R b |
|
824 | 824 | $ hg ci -m remove |
|
825 | 825 | $ hg export --git . > remove.diff |
|
826 | 826 | $ cat remove.diff | grep git |
|
827 | 827 | diff --git a/a b/a |
|
828 | 828 | diff --git a/b b/b |
|
829 | 829 | $ hg up -C 0 |
|
830 | 830 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
831 | 831 | $ hg import remove.diff |
|
832 | 832 | applying remove.diff |
|
833 | 833 | $ hg manifest |
|
834 | 834 | $ cd .. |
|
835 | 835 | |
|
836 | 836 | |
|
837 | 837 | Issue927: test update+rename with common name |
|
838 | 838 | |
|
839 | 839 | $ hg init t |
|
840 | 840 | $ cd t |
|
841 | 841 | $ touch a |
|
842 | 842 | $ hg ci -Am t |
|
843 | 843 | adding a |
|
844 | 844 | $ echo a > a |
|
845 | 845 | |
|
846 | 846 | Here, bfile.startswith(afile) |
|
847 | 847 | |
|
848 | 848 | $ hg copy a a2 |
|
849 | 849 | $ hg ci -m copya |
|
850 | 850 | $ hg export --git tip > copy.diff |
|
851 | 851 | $ hg up -C 0 |
|
852 | 852 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
853 | 853 | $ hg import copy.diff |
|
854 | 854 | applying copy.diff |
|
855 | 855 | |
|
856 | 856 | a should contain an 'a' |
|
857 | 857 | |
|
858 | 858 | $ cat a |
|
859 | 859 | a |
|
860 | 860 | |
|
861 | 861 | and a2 should have duplicated it |
|
862 | 862 | |
|
863 | 863 | $ cat a2 |
|
864 | 864 | a |
|
865 | 865 | $ cd .. |
|
866 | 866 | |
|
867 | 867 | |
|
868 | 868 | test -p0 |
|
869 | 869 | |
|
870 | 870 | $ hg init p0 |
|
871 | 871 | $ cd p0 |
|
872 | 872 | $ echo a > a |
|
873 | 873 | $ hg ci -Am t |
|
874 | 874 | adding a |
|
875 | 875 | $ hg import -p foo |
|
876 | 876 | abort: invalid value 'foo' for option -p, expected int |
|
877 | 877 | [255] |
|
878 | 878 | $ hg import -p0 - << EOF |
|
879 | 879 | > foobar |
|
880 | 880 | > --- a Sat Apr 12 22:43:58 2008 -0400 |
|
881 | 881 | > +++ a Sat Apr 12 22:44:05 2008 -0400 |
|
882 | 882 | > @@ -1,1 +1,1 @@ |
|
883 | 883 | > -a |
|
884 | 884 | > +bb |
|
885 | 885 | > EOF |
|
886 | 886 | applying patch from stdin |
|
887 | 887 | $ hg status |
|
888 | 888 | $ cat a |
|
889 | 889 | bb |
|
890 | 890 | |
|
891 | 891 | test --prefix |
|
892 | 892 | |
|
893 | 893 | $ mkdir -p dir/dir2 |
|
894 | 894 | $ echo b > dir/dir2/b |
|
895 | 895 | $ hg ci -Am b |
|
896 | 896 | adding dir/dir2/b |
|
897 | 897 | $ hg import -p2 --prefix dir - << EOF |
|
898 | 898 | > foobar |
|
899 | 899 | > --- drop1/drop2/dir2/b |
|
900 | 900 | > +++ drop1/drop2/dir2/b |
|
901 | 901 | > @@ -1,1 +1,1 @@ |
|
902 | 902 | > -b |
|
903 | 903 | > +cc |
|
904 | 904 | > EOF |
|
905 | 905 | applying patch from stdin |
|
906 | 906 | $ hg status |
|
907 | 907 | $ cat dir/dir2/b |
|
908 | 908 | cc |
|
909 | 909 | $ cd .. |
|
910 | 910 | |
|
911 | 911 | |
|
912 | 912 | test paths outside repo root |
|
913 | 913 | |
|
914 | 914 | $ mkdir outside |
|
915 | 915 | $ touch outside/foo |
|
916 | 916 | $ hg init inside |
|
917 | 917 | $ cd inside |
|
918 | 918 | $ hg import - <<EOF |
|
919 | 919 | > diff --git a/a b/b |
|
920 | 920 | > rename from ../outside/foo |
|
921 | 921 | > rename to bar |
|
922 | 922 | > EOF |
|
923 | 923 | applying patch from stdin |
|
924 | 924 | abort: path contains illegal component: ../outside/foo (glob) |
|
925 | 925 | [255] |
|
926 | 926 | $ cd .. |
|
927 | 927 | |
|
928 | 928 | |
|
929 | 929 | test import with similarity and git and strip (issue295 et al.) |
|
930 | 930 | |
|
931 | 931 | $ hg init sim |
|
932 | 932 | $ cd sim |
|
933 | 933 | $ echo 'this is a test' > a |
|
934 | 934 | $ hg ci -Ama |
|
935 | 935 | adding a |
|
936 | 936 | $ cat > ../rename.diff <<EOF |
|
937 | 937 | > diff --git a/foo/a b/foo/a |
|
938 | 938 | > deleted file mode 100644 |
|
939 | 939 | > --- a/foo/a |
|
940 | 940 | > +++ /dev/null |
|
941 | 941 | > @@ -1,1 +0,0 @@ |
|
942 | 942 | > -this is a test |
|
943 | 943 | > diff --git a/foo/b b/foo/b |
|
944 | 944 | > new file mode 100644 |
|
945 | 945 | > --- /dev/null |
|
946 | 946 | > +++ b/foo/b |
|
947 | 947 | > @@ -0,0 +1,2 @@ |
|
948 | 948 | > +this is a test |
|
949 | 949 | > +foo |
|
950 | 950 | > EOF |
|
951 | 951 | $ hg import --no-commit -v -s 1 ../rename.diff -p2 |
|
952 | 952 | applying ../rename.diff |
|
953 | 953 | patching file a |
|
954 | 954 | patching file b |
|
955 | 955 | adding b |
|
956 | 956 | recording removal of a as rename to b (88% similar) |
|
957 | 957 | applied to working directory |
|
958 | 958 | $ hg st -C |
|
959 | 959 | A b |
|
960 | 960 | a |
|
961 | 961 | R a |
|
962 | 962 | $ hg revert -a |
|
963 | 963 | undeleting a |
|
964 | 964 | forgetting b |
|
965 | 965 | $ rm b |
|
966 | 966 | $ hg import --no-commit -v -s 100 ../rename.diff -p2 |
|
967 | 967 | applying ../rename.diff |
|
968 | 968 | patching file a |
|
969 | 969 | patching file b |
|
970 | 970 | adding b |
|
971 | 971 | applied to working directory |
|
972 | 972 | $ hg st -C |
|
973 | 973 | A b |
|
974 | 974 | R a |
|
975 | 975 | $ cd .. |
|
976 | 976 | |
|
977 | 977 | |
|
978 | 978 | Issue1495: add empty file from the end of patch |
|
979 | 979 | |
|
980 | 980 | $ hg init addemptyend |
|
981 | 981 | $ cd addemptyend |
|
982 | 982 | $ touch a |
|
983 | 983 | $ hg addremove |
|
984 | 984 | adding a |
|
985 | 985 | $ hg ci -m "commit" |
|
986 | 986 | $ cat > a.patch <<EOF |
|
987 | 987 | > add a, b |
|
988 | 988 | > diff --git a/a b/a |
|
989 | 989 | > --- a/a |
|
990 | 990 | > +++ b/a |
|
991 | 991 | > @@ -0,0 +1,1 @@ |
|
992 | 992 | > +a |
|
993 | 993 | > diff --git a/b b/b |
|
994 | 994 | > new file mode 100644 |
|
995 | 995 | > EOF |
|
996 | 996 | $ hg import --no-commit a.patch |
|
997 | 997 | applying a.patch |
|
998 | 998 | |
|
999 | 999 | apply a good patch followed by an empty patch (mainly to ensure |
|
1000 | 1000 | that dirstate is *not* updated when import crashes) |
|
1001 | 1001 | $ hg update -q -C . |
|
1002 | 1002 | $ rm b |
|
1003 | 1003 | $ touch empty.patch |
|
1004 | 1004 | $ hg import a.patch empty.patch |
|
1005 | 1005 | applying a.patch |
|
1006 | 1006 | applying empty.patch |
|
1007 | 1007 | transaction abort! |
|
1008 | 1008 | rollback completed |
|
1009 | 1009 | abort: empty.patch: no diffs found |
|
1010 | 1010 | [255] |
|
1011 | 1011 | $ hg tip --template '{rev} {desc|firstline}\n' |
|
1012 | 1012 | 0 commit |
|
1013 | 1013 | $ hg -q status |
|
1014 | 1014 | M a |
|
1015 | 1015 | $ cd .. |
|
1016 | 1016 | |
|
1017 | 1017 | create file when source is not /dev/null |
|
1018 | 1018 | |
|
1019 | 1019 | $ cat > create.patch <<EOF |
|
1020 | 1020 | > diff -Naur proj-orig/foo proj-new/foo |
|
1021 | 1021 | > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 |
|
1022 | 1022 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
1023 | 1023 | > @@ -0,0 +1,1 @@ |
|
1024 | 1024 | > +a |
|
1025 | 1025 | > EOF |
|
1026 | 1026 | |
|
1027 | 1027 | some people have patches like the following too |
|
1028 | 1028 | |
|
1029 | 1029 | $ cat > create2.patch <<EOF |
|
1030 | 1030 | > diff -Naur proj-orig/foo proj-new/foo |
|
1031 | 1031 | > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 |
|
1032 | 1032 | > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
1033 | 1033 | > @@ -0,0 +1,1 @@ |
|
1034 | 1034 | > +a |
|
1035 | 1035 | > EOF |
|
1036 | 1036 | $ hg init oddcreate |
|
1037 | 1037 | $ cd oddcreate |
|
1038 | 1038 | $ hg import --no-commit ../create.patch |
|
1039 | 1039 | applying ../create.patch |
|
1040 | 1040 | $ cat foo |
|
1041 | 1041 | a |
|
1042 | 1042 | $ rm foo |
|
1043 | 1043 | $ hg revert foo |
|
1044 | 1044 | $ hg import --no-commit ../create2.patch |
|
1045 | 1045 | applying ../create2.patch |
|
1046 | 1046 | $ cat foo |
|
1047 | 1047 | a |
|
1048 | 1048 | |
|
1049 | 1049 | $ cd .. |
|
1050 | 1050 | |
|
1051 | 1051 | Issue1859: first line mistaken for email headers |
|
1052 | 1052 | |
|
1053 | 1053 | $ hg init emailconfusion |
|
1054 | 1054 | $ cd emailconfusion |
|
1055 | 1055 | $ cat > a.patch <<EOF |
|
1056 | 1056 | > module: summary |
|
1057 | 1057 | > |
|
1058 | 1058 | > description |
|
1059 | 1059 | > |
|
1060 | 1060 | > |
|
1061 | 1061 | > diff -r 000000000000 -r 9b4c1e343b55 test.txt |
|
1062 | 1062 | > --- /dev/null |
|
1063 | 1063 | > +++ b/a |
|
1064 | 1064 | > @@ -0,0 +1,1 @@ |
|
1065 | 1065 | > +a |
|
1066 | 1066 | > EOF |
|
1067 | 1067 | $ hg import -d '0 0' a.patch |
|
1068 | 1068 | applying a.patch |
|
1069 | 1069 | $ hg parents -v |
|
1070 | 1070 | changeset: 0:5a681217c0ad |
|
1071 | 1071 | tag: tip |
|
1072 | 1072 | user: test |
|
1073 | 1073 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1074 | 1074 | files: a |
|
1075 | 1075 | description: |
|
1076 | 1076 | module: summary |
|
1077 | 1077 | |
|
1078 | 1078 | description |
|
1079 | 1079 | |
|
1080 | 1080 | |
|
1081 | 1081 | $ cd .. |
|
1082 | 1082 | |
|
1083 | 1083 | |
|
1084 | 1084 | in commit message |
|
1085 | 1085 | |
|
1086 | 1086 | $ hg init commitconfusion |
|
1087 | 1087 | $ cd commitconfusion |
|
1088 | 1088 | $ cat > a.patch <<EOF |
|
1089 | 1089 | > module: summary |
|
1090 | 1090 | > |
|
1091 | 1091 | > --- description |
|
1092 | 1092 | > |
|
1093 | 1093 | > diff --git a/a b/a |
|
1094 | 1094 | > new file mode 100644 |
|
1095 | 1095 | > --- /dev/null |
|
1096 | 1096 | > +++ b/a |
|
1097 | 1097 | > @@ -0,0 +1,1 @@ |
|
1098 | 1098 | > +a |
|
1099 | 1099 | > EOF |
|
1100 | 1100 | > hg import -d '0 0' a.patch |
|
1101 | 1101 | > hg parents -v |
|
1102 | 1102 | > cd .. |
|
1103 | 1103 | > |
|
1104 | 1104 | > echo '% tricky header splitting' |
|
1105 | 1105 | > cat > trickyheaders.patch <<EOF |
|
1106 | 1106 | > From: User A <user@a> |
|
1107 | 1107 | > Subject: [PATCH] from: tricky! |
|
1108 | 1108 | > |
|
1109 | 1109 | > # HG changeset patch |
|
1110 | 1110 | > # User User B |
|
1111 | 1111 | > # Date 1266264441 18000 |
|
1112 | 1112 | > # Branch stable |
|
1113 | 1113 | > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 |
|
1114 | 1114 | > # Parent 0000000000000000000000000000000000000000 |
|
1115 | 1115 | > from: tricky! |
|
1116 | 1116 | > |
|
1117 | 1117 | > That is not a header. |
|
1118 | 1118 | > |
|
1119 | 1119 | > diff -r 000000000000 -r f2be6a1170ac foo |
|
1120 | 1120 | > --- /dev/null |
|
1121 | 1121 | > +++ b/foo |
|
1122 | 1122 | > @@ -0,0 +1,1 @@ |
|
1123 | 1123 | > +foo |
|
1124 | 1124 | > EOF |
|
1125 | 1125 | applying a.patch |
|
1126 | 1126 | changeset: 0:f34d9187897d |
|
1127 | 1127 | tag: tip |
|
1128 | 1128 | user: test |
|
1129 | 1129 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1130 | 1130 | files: a |
|
1131 | 1131 | description: |
|
1132 | 1132 | module: summary |
|
1133 | 1133 | |
|
1134 | 1134 | |
|
1135 | 1135 | % tricky header splitting |
|
1136 | 1136 | |
|
1137 | 1137 | $ hg init trickyheaders |
|
1138 | 1138 | $ cd trickyheaders |
|
1139 | 1139 | $ hg import -d '0 0' ../trickyheaders.patch |
|
1140 | 1140 | applying ../trickyheaders.patch |
|
1141 | 1141 | $ hg export --git tip |
|
1142 | 1142 | # HG changeset patch |
|
1143 | 1143 | # User User B |
|
1144 | 1144 | # Date 0 0 |
|
1145 | 1145 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1146 | 1146 | # Node ID eb56ab91903632294ac504838508cb370c0901d2 |
|
1147 | 1147 | # Parent 0000000000000000000000000000000000000000 |
|
1148 | 1148 | from: tricky! |
|
1149 | 1149 | |
|
1150 | 1150 | That is not a header. |
|
1151 | 1151 | |
|
1152 | 1152 | diff --git a/foo b/foo |
|
1153 | 1153 | new file mode 100644 |
|
1154 | 1154 | --- /dev/null |
|
1155 | 1155 | +++ b/foo |
|
1156 | 1156 | @@ -0,0 +1,1 @@ |
|
1157 | 1157 | +foo |
|
1158 | 1158 | $ cd .. |
|
1159 | 1159 | |
|
1160 | 1160 | |
|
1161 | 1161 | Issue2102: hg export and hg import speak different languages |
|
1162 | 1162 | |
|
1163 | 1163 | $ hg init issue2102 |
|
1164 | 1164 | $ cd issue2102 |
|
1165 | 1165 | $ mkdir -p src/cmd/gc |
|
1166 | 1166 | $ touch src/cmd/gc/mksys.bash |
|
1167 | 1167 | $ hg ci -Am init |
|
1168 | 1168 | adding src/cmd/gc/mksys.bash |
|
1169 | 1169 | $ hg import - <<EOF |
|
1170 | 1170 | > # HG changeset patch |
|
1171 | 1171 | > # User Rob Pike |
|
1172 | 1172 | > # Date 1216685449 25200 |
|
1173 | 1173 | > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 |
|
1174 | 1174 | > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 |
|
1175 | 1175 | > help management of empty pkg and lib directories in perforce |
|
1176 | 1176 | > |
|
1177 | 1177 | > R=gri |
|
1178 | 1178 | > DELTA=4 (4 added, 0 deleted, 0 changed) |
|
1179 | 1179 | > OCL=13328 |
|
1180 | 1180 | > CL=13328 |
|
1181 | 1181 | > |
|
1182 | 1182 | > diff --git a/lib/place-holder b/lib/place-holder |
|
1183 | 1183 | > new file mode 100644 |
|
1184 | 1184 | > --- /dev/null |
|
1185 | 1185 | > +++ b/lib/place-holder |
|
1186 | 1186 | > @@ -0,0 +1,2 @@ |
|
1187 | 1187 | > +perforce does not maintain empty directories. |
|
1188 | 1188 | > +this file helps. |
|
1189 | 1189 | > diff --git a/pkg/place-holder b/pkg/place-holder |
|
1190 | 1190 | > new file mode 100644 |
|
1191 | 1191 | > --- /dev/null |
|
1192 | 1192 | > +++ b/pkg/place-holder |
|
1193 | 1193 | > @@ -0,0 +1,2 @@ |
|
1194 | 1194 | > +perforce does not maintain empty directories. |
|
1195 | 1195 | > +this file helps. |
|
1196 | 1196 | > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
1197 | 1197 | > old mode 100644 |
|
1198 | 1198 | > new mode 100755 |
|
1199 | 1199 | > EOF |
|
1200 | 1200 | applying patch from stdin |
|
1201 | 1201 | |
|
1202 | 1202 | #if execbit |
|
1203 | 1203 | |
|
1204 | 1204 | $ hg sum |
|
1205 | 1205 | parent: 1:d59915696727 tip |
|
1206 | 1206 | help management of empty pkg and lib directories in perforce |
|
1207 | 1207 | branch: default |
|
1208 | 1208 | commit: (clean) |
|
1209 | 1209 | update: (current) |
|
1210 | 1210 | phases: 2 draft |
|
1211 | 1211 | |
|
1212 | 1212 | $ hg diff --git -c tip |
|
1213 | 1213 | diff --git a/lib/place-holder b/lib/place-holder |
|
1214 | 1214 | new file mode 100644 |
|
1215 | 1215 | --- /dev/null |
|
1216 | 1216 | +++ b/lib/place-holder |
|
1217 | 1217 | @@ -0,0 +1,2 @@ |
|
1218 | 1218 | +perforce does not maintain empty directories. |
|
1219 | 1219 | +this file helps. |
|
1220 | 1220 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
1221 | 1221 | new file mode 100644 |
|
1222 | 1222 | --- /dev/null |
|
1223 | 1223 | +++ b/pkg/place-holder |
|
1224 | 1224 | @@ -0,0 +1,2 @@ |
|
1225 | 1225 | +perforce does not maintain empty directories. |
|
1226 | 1226 | +this file helps. |
|
1227 | 1227 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
1228 | 1228 | old mode 100644 |
|
1229 | 1229 | new mode 100755 |
|
1230 | 1230 | |
|
1231 | 1231 | #else |
|
1232 | 1232 | |
|
1233 | 1233 | $ hg sum |
|
1234 | 1234 | parent: 1:28f089cc9ccc tip |
|
1235 | 1235 | help management of empty pkg and lib directories in perforce |
|
1236 | 1236 | branch: default |
|
1237 | 1237 | commit: (clean) |
|
1238 | 1238 | update: (current) |
|
1239 | 1239 | phases: 2 draft |
|
1240 | 1240 | |
|
1241 | 1241 | $ hg diff --git -c tip |
|
1242 | 1242 | diff --git a/lib/place-holder b/lib/place-holder |
|
1243 | 1243 | new file mode 100644 |
|
1244 | 1244 | --- /dev/null |
|
1245 | 1245 | +++ b/lib/place-holder |
|
1246 | 1246 | @@ -0,0 +1,2 @@ |
|
1247 | 1247 | +perforce does not maintain empty directories. |
|
1248 | 1248 | +this file helps. |
|
1249 | 1249 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
1250 | 1250 | new file mode 100644 |
|
1251 | 1251 | --- /dev/null |
|
1252 | 1252 | +++ b/pkg/place-holder |
|
1253 | 1253 | @@ -0,0 +1,2 @@ |
|
1254 | 1254 | +perforce does not maintain empty directories. |
|
1255 | 1255 | +this file helps. |
|
1256 | 1256 | |
|
1257 | 1257 | /* The mode change for mksys.bash is missing here, because on platforms */ |
|
1258 | 1258 | /* that don't support execbits, mode changes in patches are ignored when */ |
|
1259 | 1259 | /* they are imported. This is obviously also the reason for why the hash */ |
|
1260 | 1260 | /* in the created changeset is different to the one you see above the */ |
|
1261 | 1261 | /* #else clause */ |
|
1262 | 1262 | |
|
1263 | 1263 | #endif |
|
1264 | 1264 | $ cd .. |
|
1265 | 1265 | |
|
1266 | 1266 | |
|
1267 | 1267 | diff lines looking like headers |
|
1268 | 1268 | |
|
1269 | 1269 | $ hg init difflineslikeheaders |
|
1270 | 1270 | $ cd difflineslikeheaders |
|
1271 | 1271 | $ echo a >a |
|
1272 | 1272 | $ echo b >b |
|
1273 | 1273 | $ echo c >c |
|
1274 | 1274 | $ hg ci -Am1 |
|
1275 | 1275 | adding a |
|
1276 | 1276 | adding b |
|
1277 | 1277 | adding c |
|
1278 | 1278 | |
|
1279 | 1279 | $ echo "key: value" >>a |
|
1280 | 1280 | $ echo "key: value" >>b |
|
1281 | 1281 | $ echo "foo" >>c |
|
1282 | 1282 | $ hg ci -m2 |
|
1283 | 1283 | |
|
1284 | 1284 | $ hg up -C 0 |
|
1285 | 1285 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1286 | 1286 | $ hg diff --git -c1 >want |
|
1287 | 1287 | $ hg diff -c1 | hg import --no-commit - |
|
1288 | 1288 | applying patch from stdin |
|
1289 | 1289 | $ hg diff --git >have |
|
1290 | 1290 | $ diff want have |
|
1291 | 1291 | $ cd .. |
|
1292 | 1292 | |
|
1293 | 1293 | import a unified diff with no lines of context (diff -U0) |
|
1294 | 1294 | |
|
1295 | 1295 | $ hg init diffzero |
|
1296 | 1296 | $ cd diffzero |
|
1297 | 1297 | $ cat > f << EOF |
|
1298 | 1298 | > c2 |
|
1299 | 1299 | > c4 |
|
1300 | 1300 | > c5 |
|
1301 | 1301 | > EOF |
|
1302 | 1302 | $ hg commit -Am0 |
|
1303 | 1303 | adding f |
|
1304 | 1304 | |
|
1305 | 1305 | $ hg import --no-commit - << EOF |
|
1306 | 1306 | > # HG changeset patch |
|
1307 | 1307 | > # User test |
|
1308 | 1308 | > # Date 0 0 |
|
1309 | 1309 | > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c |
|
1310 | 1310 | > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794 |
|
1311 | 1311 | > 1 |
|
1312 | 1312 | > diff -r 8679a12a975b -r f4974ab632f3 f |
|
1313 | 1313 | > --- a/f Thu Jan 01 00:00:00 1970 +0000 |
|
1314 | 1314 | > +++ b/f Thu Jan 01 00:00:00 1970 +0000 |
|
1315 | 1315 | > @@ -0,0 +1,1 @@ |
|
1316 | 1316 | > +c1 |
|
1317 | 1317 | > @@ -1,0 +3,1 @@ |
|
1318 | 1318 | > +c3 |
|
1319 | 1319 | > @@ -3,1 +4,0 @@ |
|
1320 | 1320 | > -c5 |
|
1321 | 1321 | > EOF |
|
1322 | 1322 | applying patch from stdin |
|
1323 | 1323 | |
|
1324 | 1324 | $ cat f |
|
1325 | 1325 | c1 |
|
1326 | 1326 | c2 |
|
1327 | 1327 | c3 |
|
1328 | 1328 | c4 |
|
1329 | 1329 | |
|
1330 | 1330 | $ cd .. |
|
1331 | 1331 | |
|
1332 | 1332 | no segfault while importing a unified diff which start line is zero but chunk |
|
1333 | 1333 | size is non-zero |
|
1334 | 1334 | |
|
1335 | 1335 | $ hg init startlinezero |
|
1336 | 1336 | $ cd startlinezero |
|
1337 | 1337 | $ echo foo > foo |
|
1338 | 1338 | $ hg commit -Amfoo |
|
1339 | 1339 | adding foo |
|
1340 | 1340 | |
|
1341 | 1341 | $ hg import --no-commit - << EOF |
|
1342 | 1342 | > diff a/foo b/foo |
|
1343 | 1343 | > --- a/foo |
|
1344 | 1344 | > +++ b/foo |
|
1345 | 1345 | > @@ -0,1 +0,1 @@ |
|
1346 | 1346 | > foo |
|
1347 | 1347 | > EOF |
|
1348 | 1348 | applying patch from stdin |
|
1349 | 1349 | |
|
1350 | 1350 | $ cd .. |
|
1351 | 1351 | |
|
1352 | 1352 | Test corner case involving fuzz and skew |
|
1353 | 1353 | |
|
1354 | 1354 | $ hg init morecornercases |
|
1355 | 1355 | $ cd morecornercases |
|
1356 | 1356 | |
|
1357 | 1357 | $ cat > 01-no-context-beginning-of-file.diff <<EOF |
|
1358 | 1358 | > diff --git a/a b/a |
|
1359 | 1359 | > --- a/a |
|
1360 | 1360 | > +++ b/a |
|
1361 | 1361 | > @@ -1,0 +1,1 @@ |
|
1362 | 1362 | > +line |
|
1363 | 1363 | > EOF |
|
1364 | 1364 | |
|
1365 | 1365 | $ cat > 02-no-context-middle-of-file.diff <<EOF |
|
1366 | 1366 | > diff --git a/a b/a |
|
1367 | 1367 | > --- a/a |
|
1368 | 1368 | > +++ b/a |
|
1369 | 1369 | > @@ -1,1 +1,1 @@ |
|
1370 | 1370 | > -2 |
|
1371 | 1371 | > +add some skew |
|
1372 | 1372 | > @@ -2,0 +2,1 @@ |
|
1373 | 1373 | > +line |
|
1374 | 1374 | > EOF |
|
1375 | 1375 | |
|
1376 | 1376 | $ cat > 03-no-context-end-of-file.diff <<EOF |
|
1377 | 1377 | > diff --git a/a b/a |
|
1378 | 1378 | > --- a/a |
|
1379 | 1379 | > +++ b/a |
|
1380 | 1380 | > @@ -10,0 +10,1 @@ |
|
1381 | 1381 | > +line |
|
1382 | 1382 | > EOF |
|
1383 | 1383 | |
|
1384 | 1384 | $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF |
|
1385 | 1385 | > diff --git a/a b/a |
|
1386 | 1386 | > --- a/a |
|
1387 | 1387 | > +++ b/a |
|
1388 | 1388 | > @@ -1,1 +1,1 @@ |
|
1389 | 1389 | > -2 |
|
1390 | 1390 | > +add some skew |
|
1391 | 1391 | > @@ -2,2 +2,3 @@ |
|
1392 | 1392 | > not matching, should fuzz |
|
1393 | 1393 | > ... a bit |
|
1394 | 1394 | > +line |
|
1395 | 1395 | > EOF |
|
1396 | 1396 | |
|
1397 | 1397 | $ cat > a <<EOF |
|
1398 | 1398 | > 1 |
|
1399 | 1399 | > 2 |
|
1400 | 1400 | > 3 |
|
1401 | 1401 | > 4 |
|
1402 | 1402 | > EOF |
|
1403 | 1403 | $ hg ci -Am adda a |
|
1404 | 1404 | $ for p in *.diff; do |
|
1405 | 1405 | > hg import -v --no-commit $p |
|
1406 | 1406 | > cat a |
|
1407 | 1407 | > hg revert -aqC a |
|
1408 | 1408 | > # patch -p1 < $p |
|
1409 | 1409 | > # cat a |
|
1410 | 1410 | > # hg revert -aC a |
|
1411 | 1411 | > done |
|
1412 | 1412 | applying 01-no-context-beginning-of-file.diff |
|
1413 | 1413 | patching file a |
|
1414 | 1414 | applied to working directory |
|
1415 | 1415 | 1 |
|
1416 | 1416 | line |
|
1417 | 1417 | 2 |
|
1418 | 1418 | 3 |
|
1419 | 1419 | 4 |
|
1420 | 1420 | applying 02-no-context-middle-of-file.diff |
|
1421 | 1421 | patching file a |
|
1422 | 1422 | Hunk #1 succeeded at 2 (offset 1 lines). |
|
1423 | 1423 | Hunk #2 succeeded at 4 (offset 1 lines). |
|
1424 | 1424 | applied to working directory |
|
1425 | 1425 | 1 |
|
1426 | 1426 | add some skew |
|
1427 | 1427 | 3 |
|
1428 | 1428 | line |
|
1429 | 1429 | 4 |
|
1430 | 1430 | applying 03-no-context-end-of-file.diff |
|
1431 | 1431 | patching file a |
|
1432 | 1432 | Hunk #1 succeeded at 5 (offset -6 lines). |
|
1433 | 1433 | applied to working directory |
|
1434 | 1434 | 1 |
|
1435 | 1435 | 2 |
|
1436 | 1436 | 3 |
|
1437 | 1437 | 4 |
|
1438 | 1438 | line |
|
1439 | 1439 | applying 04-middle-of-file-completely-fuzzed.diff |
|
1440 | 1440 | patching file a |
|
1441 | 1441 | Hunk #1 succeeded at 2 (offset 1 lines). |
|
1442 | 1442 | Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines). |
|
1443 | 1443 | applied to working directory |
|
1444 | 1444 | 1 |
|
1445 | 1445 | add some skew |
|
1446 | 1446 | 3 |
|
1447 | 1447 | 4 |
|
1448 | 1448 | line |
|
1449 | 1449 | $ cd .. |
|
1450 | 1450 | |
|
1451 | 1451 | Test partial application |
|
1452 | 1452 | ------------------------ |
|
1453 | 1453 | |
|
1454 | 1454 | prepare a stack of patches depending on each other |
|
1455 | 1455 | |
|
1456 | 1456 | $ hg init partial |
|
1457 | 1457 | $ cd partial |
|
1458 | 1458 | $ cat << EOF > a |
|
1459 | 1459 | > one |
|
1460 | 1460 | > two |
|
1461 | 1461 | > three |
|
1462 | 1462 | > four |
|
1463 | 1463 | > five |
|
1464 | 1464 | > six |
|
1465 | 1465 | > seven |
|
1466 | 1466 | > EOF |
|
1467 | 1467 | $ hg add a |
|
1468 | 1468 | $ echo 'b' > b |
|
1469 | 1469 | $ hg add b |
|
1470 | 1470 | $ hg commit -m 'initial' -u Babar |
|
1471 | 1471 | $ cat << EOF > a |
|
1472 | 1472 | > one |
|
1473 | 1473 | > two |
|
1474 | 1474 | > 3 |
|
1475 | 1475 | > four |
|
1476 | 1476 | > five |
|
1477 | 1477 | > six |
|
1478 | 1478 | > seven |
|
1479 | 1479 | > EOF |
|
1480 | 1480 | $ hg commit -m 'three' -u Celeste |
|
1481 | 1481 | $ cat << EOF > a |
|
1482 | 1482 | > one |
|
1483 | 1483 | > two |
|
1484 | 1484 | > 3 |
|
1485 | 1485 | > 4 |
|
1486 | 1486 | > five |
|
1487 | 1487 | > six |
|
1488 | 1488 | > seven |
|
1489 | 1489 | > EOF |
|
1490 | 1490 | $ hg commit -m 'four' -u Rataxes |
|
1491 | 1491 | $ cat << EOF > a |
|
1492 | 1492 | > one |
|
1493 | 1493 | > two |
|
1494 | 1494 | > 3 |
|
1495 | 1495 | > 4 |
|
1496 | 1496 | > 5 |
|
1497 | 1497 | > six |
|
1498 | 1498 | > seven |
|
1499 | 1499 | > EOF |
|
1500 | 1500 | $ echo bb >> b |
|
1501 | 1501 | $ hg commit -m 'five' -u Arthur |
|
1502 | 1502 | $ echo 'Babar' > jungle |
|
1503 | 1503 | $ hg add jungle |
|
1504 | 1504 | $ hg ci -m 'jungle' -u Zephir |
|
1505 | 1505 | $ echo 'Celeste' >> jungle |
|
1506 | 1506 | $ hg ci -m 'extended jungle' -u Cornelius |
|
1507 | 1507 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1508 | 1508 | @ extended jungle [Cornelius] 1: +1/-0 |
|
1509 | 1509 | | |
|
1510 | 1510 | o jungle [Zephir] 1: +1/-0 |
|
1511 | 1511 | | |
|
1512 | 1512 | o five [Arthur] 2: +2/-1 |
|
1513 | 1513 | | |
|
1514 | 1514 | o four [Rataxes] 1: +1/-1 |
|
1515 | 1515 | | |
|
1516 | 1516 | o three [Celeste] 1: +1/-1 |
|
1517 | 1517 | | |
|
1518 | 1518 | o initial [Babar] 2: +8/-0 |
|
1519 | 1519 | |
|
1520 | 1520 | Adding those config options should not change the output of diffstat. Bugfix #4755. |
|
1521 | 1521 | |
|
1522 | 1522 | $ hg log -r . --template '{diffstat}\n' |
|
1523 | 1523 | 1: +1/-0 |
|
1524 | 1524 | $ hg log -r . --template '{diffstat}\n' --config diff.git=1 \ |
|
1525 | 1525 | > --config diff.noprefix=1 |
|
1526 | 1526 | 1: +1/-0 |
|
1527 | 1527 | |
|
1528 | 1528 | Importing with some success and some errors: |
|
1529 | 1529 | |
|
1530 | 1530 | $ hg update --rev 'desc(initial)' |
|
1531 | 1531 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1532 | 1532 | $ hg export --rev 'desc(five)' | hg import --partial - |
|
1533 | 1533 | applying patch from stdin |
|
1534 | 1534 | patching file a |
|
1535 | 1535 | Hunk #1 FAILED at 1 |
|
1536 | 1536 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
1537 | 1537 | patch applied partially |
|
1538 | 1538 | (fix the .rej files and run `hg commit --amend`) |
|
1539 | 1539 | [1] |
|
1540 | 1540 | |
|
1541 | 1541 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1542 | 1542 | @ five [Arthur] 1: +1/-0 |
|
1543 | 1543 | | |
|
1544 | 1544 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1545 | 1545 | | | |
|
1546 | 1546 | | o jungle [Zephir] 1: +1/-0 |
|
1547 | 1547 | | | |
|
1548 | 1548 | | o five [Arthur] 2: +2/-1 |
|
1549 | 1549 | | | |
|
1550 | 1550 | | o four [Rataxes] 1: +1/-1 |
|
1551 | 1551 | | | |
|
1552 | 1552 | | o three [Celeste] 1: +1/-1 |
|
1553 | 1553 | |/ |
|
1554 | 1554 | o initial [Babar] 2: +8/-0 |
|
1555 | 1555 | |
|
1556 | 1556 | $ hg export |
|
1557 | 1557 | # HG changeset patch |
|
1558 | 1558 | # User Arthur |
|
1559 | 1559 | # Date 0 0 |
|
1560 | 1560 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1561 | 1561 | # Node ID 26e6446bb2526e2be1037935f5fca2b2706f1509 |
|
1562 | 1562 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e |
|
1563 | 1563 | five |
|
1564 | 1564 | |
|
1565 | 1565 | diff -r 8e4f0351909e -r 26e6446bb252 b |
|
1566 | 1566 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
1567 | 1567 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
1568 | 1568 | @@ -1,1 +1,2 @@ |
|
1569 | 1569 | b |
|
1570 | 1570 | +bb |
|
1571 | 1571 | $ hg status -c . |
|
1572 | 1572 | C a |
|
1573 | 1573 | C b |
|
1574 | 1574 | $ ls |
|
1575 | 1575 | a |
|
1576 | 1576 | a.rej |
|
1577 | 1577 | b |
|
1578 | 1578 | |
|
1579 | 1579 | Importing with zero success: |
|
1580 | 1580 | |
|
1581 | 1581 | $ hg update --rev 'desc(initial)' |
|
1582 | 1582 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1583 | 1583 | $ hg export --rev 'desc(four)' | hg import --partial - |
|
1584 | 1584 | applying patch from stdin |
|
1585 | 1585 | patching file a |
|
1586 | 1586 | Hunk #1 FAILED at 0 |
|
1587 | 1587 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
1588 | 1588 | patch applied partially |
|
1589 | 1589 | (fix the .rej files and run `hg commit --amend`) |
|
1590 | 1590 | [1] |
|
1591 | 1591 | |
|
1592 | 1592 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1593 | 1593 | @ four [Rataxes] 0: +0/-0 |
|
1594 | 1594 | | |
|
1595 | 1595 | | o five [Arthur] 1: +1/-0 |
|
1596 | 1596 | |/ |
|
1597 | 1597 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1598 | 1598 | | | |
|
1599 | 1599 | | o jungle [Zephir] 1: +1/-0 |
|
1600 | 1600 | | | |
|
1601 | 1601 | | o five [Arthur] 2: +2/-1 |
|
1602 | 1602 | | | |
|
1603 | 1603 | | o four [Rataxes] 1: +1/-1 |
|
1604 | 1604 | | | |
|
1605 | 1605 | | o three [Celeste] 1: +1/-1 |
|
1606 | 1606 | |/ |
|
1607 | 1607 | o initial [Babar] 2: +8/-0 |
|
1608 | 1608 | |
|
1609 | 1609 | $ hg export |
|
1610 | 1610 | # HG changeset patch |
|
1611 | 1611 | # User Rataxes |
|
1612 | 1612 | # Date 0 0 |
|
1613 | 1613 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1614 | 1614 | # Node ID cb9b1847a74d9ad52e93becaf14b98dbcc274e1e |
|
1615 | 1615 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e |
|
1616 | 1616 | four |
|
1617 | 1617 | |
|
1618 | 1618 | $ hg status -c . |
|
1619 | 1619 | C a |
|
1620 | 1620 | C b |
|
1621 | 1621 | $ ls |
|
1622 | 1622 | a |
|
1623 | 1623 | a.rej |
|
1624 | 1624 | b |
|
1625 | 1625 | |
|
1626 | 1626 | Importing with unknown file: |
|
1627 | 1627 | |
|
1628 | 1628 | $ hg update --rev 'desc(initial)' |
|
1629 | 1629 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1630 | 1630 | $ hg export --rev 'desc("extended jungle")' | hg import --partial - |
|
1631 | 1631 | applying patch from stdin |
|
1632 | 1632 | unable to find 'jungle' for patching |
|
1633 | 1633 | (use '--prefix' to apply patch relative to the current directory) |
|
1634 | 1634 | 1 out of 1 hunks FAILED -- saving rejects to file jungle.rej |
|
1635 | 1635 | patch applied partially |
|
1636 | 1636 | (fix the .rej files and run `hg commit --amend`) |
|
1637 | 1637 | [1] |
|
1638 | 1638 | |
|
1639 | 1639 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1640 | 1640 | @ extended jungle [Cornelius] 0: +0/-0 |
|
1641 | 1641 | | |
|
1642 | 1642 | | o four [Rataxes] 0: +0/-0 |
|
1643 | 1643 | |/ |
|
1644 | 1644 | | o five [Arthur] 1: +1/-0 |
|
1645 | 1645 | |/ |
|
1646 | 1646 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1647 | 1647 | | | |
|
1648 | 1648 | | o jungle [Zephir] 1: +1/-0 |
|
1649 | 1649 | | | |
|
1650 | 1650 | | o five [Arthur] 2: +2/-1 |
|
1651 | 1651 | | | |
|
1652 | 1652 | | o four [Rataxes] 1: +1/-1 |
|
1653 | 1653 | | | |
|
1654 | 1654 | | o three [Celeste] 1: +1/-1 |
|
1655 | 1655 | |/ |
|
1656 | 1656 | o initial [Babar] 2: +8/-0 |
|
1657 | 1657 | |
|
1658 | 1658 | $ hg export |
|
1659 | 1659 | # HG changeset patch |
|
1660 | 1660 | # User Cornelius |
|
1661 | 1661 | # Date 0 0 |
|
1662 | 1662 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1663 | 1663 | # Node ID 1fb1f86bef43c5a75918178f8d23c29fb0a7398d |
|
1664 | 1664 | # Parent 8e4f0351909eae6b9cf68c2c076cb54c42b54b2e |
|
1665 | 1665 | extended jungle |
|
1666 | 1666 | |
|
1667 | 1667 | $ hg status -c . |
|
1668 | 1668 | C a |
|
1669 | 1669 | C b |
|
1670 | 1670 | $ ls |
|
1671 | 1671 | a |
|
1672 | 1672 | a.rej |
|
1673 | 1673 | b |
|
1674 | 1674 | jungle.rej |
|
1675 | 1675 | |
|
1676 | 1676 | Importing multiple failing patches: |
|
1677 | 1677 | |
|
1678 | 1678 | $ hg update --rev 'desc(initial)' |
|
1679 | 1679 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1680 | 1680 | $ echo 'B' > b # just to make another commit |
|
1681 | 1681 | $ hg commit -m "a new base" |
|
1682 | 1682 | created new head |
|
1683 | 1683 | $ hg export --rev 'desc("four") + desc("extended jungle")' | hg import --partial - |
|
1684 | 1684 | applying patch from stdin |
|
1685 | 1685 | patching file a |
|
1686 | 1686 | Hunk #1 FAILED at 0 |
|
1687 | 1687 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
1688 | 1688 | patch applied partially |
|
1689 | 1689 | (fix the .rej files and run `hg commit --amend`) |
|
1690 | 1690 | [1] |
|
1691 | 1691 | $ hg log -G --template '{desc|firstline} [{author}] {diffstat}\n' |
|
1692 | 1692 | @ four [Rataxes] 0: +0/-0 |
|
1693 | 1693 | | |
|
1694 | 1694 | o a new base [test] 1: +1/-1 |
|
1695 | 1695 | | |
|
1696 | 1696 | | o extended jungle [Cornelius] 0: +0/-0 |
|
1697 | 1697 | |/ |
|
1698 | 1698 | | o four [Rataxes] 0: +0/-0 |
|
1699 | 1699 | |/ |
|
1700 | 1700 | | o five [Arthur] 1: +1/-0 |
|
1701 | 1701 | |/ |
|
1702 | 1702 | | o extended jungle [Cornelius] 1: +1/-0 |
|
1703 | 1703 | | | |
|
1704 | 1704 | | o jungle [Zephir] 1: +1/-0 |
|
1705 | 1705 | | | |
|
1706 | 1706 | | o five [Arthur] 2: +2/-1 |
|
1707 | 1707 | | | |
|
1708 | 1708 | | o four [Rataxes] 1: +1/-1 |
|
1709 | 1709 | | | |
|
1710 | 1710 | | o three [Celeste] 1: +1/-1 |
|
1711 | 1711 | |/ |
|
1712 | 1712 | o initial [Babar] 2: +8/-0 |
|
1713 | 1713 | |
|
1714 | 1714 | $ hg export |
|
1715 | 1715 | # HG changeset patch |
|
1716 | 1716 | # User Rataxes |
|
1717 | 1717 | # Date 0 0 |
|
1718 | 1718 | # Thu Jan 01 00:00:00 1970 +0000 |
|
1719 | 1719 | # Node ID a9d7b6d0ffbb4eb12b7d5939250fcd42e8930a1d |
|
1720 | 1720 | # Parent f59f8d2e95a8ca5b1b4ca64320140da85f3b44fd |
|
1721 | 1721 | four |
|
1722 | 1722 | |
|
1723 | 1723 | $ hg status -c . |
|
1724 | 1724 | C a |
|
1725 | 1725 | C b |
|
1726 | 1726 | |
|
1727 | 1727 | Importing some extra header |
|
1728 | 1728 | =========================== |
|
1729 | 1729 | |
|
1730 | 1730 | $ cat > $TESTTMP/parseextra.py <<EOF |
|
1731 | 1731 | > import mercurial.patch |
|
1732 | 1732 | > import mercurial.cmdutil |
|
1733 | 1733 | > |
|
1734 | 1734 | > def processfoo(repo, data, extra, opts): |
|
1735 | 1735 | > if 'foo' in data: |
|
1736 | 1736 | > extra['foo'] = data['foo'] |
|
1737 | 1737 | > def postimport(ctx): |
|
1738 | 1738 | > if 'foo' in ctx.extra(): |
|
1739 | 1739 | > ctx.repo().ui.write('imported-foo: %s\n' % ctx.extra()['foo']) |
|
1740 | 1740 | > |
|
1741 | 1741 | > mercurial.patch.patchheadermap.append(('Foo', 'foo')) |
|
1742 | 1742 | > mercurial.cmdutil.extrapreimport.append('foo') |
|
1743 | 1743 | > mercurial.cmdutil.extrapreimportmap['foo'] = processfoo |
|
1744 | 1744 | > mercurial.cmdutil.extrapostimport.append('foo') |
|
1745 | 1745 | > mercurial.cmdutil.extrapostimportmap['foo'] = postimport |
|
1746 | 1746 | > EOF |
|
1747 | 1747 | $ cat >> $HGRCPATH <<EOF |
|
1748 | 1748 | > [extensions] |
|
1749 | 1749 | > parseextra=$TESTTMP/parseextra.py |
|
1750 | 1750 | > EOF |
|
1751 | 1751 | $ hg up -C tip |
|
1752 | 1752 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1753 | 1753 | $ cat > $TESTTMP/foo.patch <<EOF |
|
1754 | 1754 | > # HG changeset patch |
|
1755 | 1755 | > # User Rataxes |
|
1756 | 1756 | > # Date 0 0 |
|
1757 | 1757 | > # Thu Jan 01 00:00:00 1970 +0000 |
|
1758 | 1758 | > # Foo bar |
|
1759 | 1759 | > height |
|
1760 | 1760 | > |
|
1761 | 1761 | > --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1762 | 1762 | > +++ b/a Wed Oct 07 09:17:44 2015 +0000 |
|
1763 | 1763 | > @@ -5,3 +5,4 @@ |
|
1764 | 1764 | > five |
|
1765 | 1765 | > six |
|
1766 | 1766 | > seven |
|
1767 | 1767 | > +heigt |
|
1768 | 1768 | > EOF |
|
1769 | 1769 | $ hg import $TESTTMP/foo.patch |
|
1770 | 1770 | applying $TESTTMP/foo.patch |
|
1771 | 1771 | imported-foo: bar |
|
1772 | 1772 | $ hg log --debug -r . | grep extra |
|
1773 | 1773 | extra: branch=default |
|
1774 | 1774 | extra: foo=bar |
|
1775 | 1775 | |
|
1776 | 1776 | Warn the user that paths are relative to the root of |
|
1777 | 1777 | repository when file not found for patching |
|
1778 | 1778 | |
|
1779 | 1779 | $ mkdir filedir |
|
1780 | 1780 | $ echo "file1" >> filedir/file1 |
|
1781 | 1781 | $ hg add filedir/file1 |
|
1782 | 1782 | $ hg commit -m "file1" |
|
1783 | 1783 | $ cd filedir |
|
1784 | 1784 | $ hg import -p 2 - <<EOF |
|
1785 | 1785 | > # HG changeset patch |
|
1786 | 1786 | > # User test |
|
1787 | 1787 | > # Date 0 0 |
|
1788 | 1788 | > file2 |
|
1789 | 1789 | > |
|
1790 | 1790 | > diff --git a/filedir/file1 b/filedir/file1 |
|
1791 | 1791 | > --- a/filedir/file1 |
|
1792 | 1792 | > +++ b/filedir/file1 |
|
1793 | 1793 | > @@ -1,1 +1,2 @@ |
|
1794 | 1794 | > file1 |
|
1795 | 1795 | > +file2 |
|
1796 | 1796 | > EOF |
|
1797 | 1797 | applying patch from stdin |
|
1798 | 1798 | unable to find 'file1' for patching |
|
1799 | 1799 | (use '--prefix' to apply patch relative to the current directory) |
|
1800 | 1800 | 1 out of 1 hunks FAILED -- saving rejects to file file1.rej |
|
1801 | 1801 | abort: patch failed to apply |
|
1802 | 1802 | [255] |
|
1803 | 1803 | |
|
1804 | 1804 | test import crash (issue5375) |
|
1805 | 1805 | $ cd .. |
|
1806 | 1806 | $ hg init repo |
|
1807 | 1807 | $ cd repo |
|
1808 | 1808 | $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import - |
|
1809 | 1809 | applying patch from stdin |
|
1810 | 1810 | a not tracked! |
|
1811 | 1811 | abort: source file 'a' does not exist |
|
1812 | 1812 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now