Show More
@@ -1,497 +1,497 | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | hg init a |
|
4 | 4 | mkdir a/d1 |
|
5 | 5 | mkdir a/d1/d2 |
|
6 | 6 | echo line 1 > a/a |
|
7 | 7 | echo line 1 > a/d1/d2/a |
|
8 | 8 | hg --cwd a ci -Ama |
|
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 | echo % import exported patch |
|
14 | 14 | hg clone -r0 a b |
|
15 | 15 | hg --cwd a export tip > tip.patch |
|
16 | 16 | hg --cwd b import ../tip.patch |
|
17 | 17 | echo % message should be same |
|
18 | 18 | hg --cwd b tip | grep 'second change' |
|
19 | 19 | echo % committer should be same |
|
20 | 20 | hg --cwd b tip | grep someone |
|
21 | 21 | rm -r b |
|
22 | 22 | |
|
23 | 23 | echo % import exported patch with external patcher |
|
24 | 24 | cat > dummypatch.py <<EOF |
|
25 | 25 | print 'patching file a' |
|
26 | 26 | file('a', 'wb').write('line2\n') |
|
27 | 27 | EOF |
|
28 | 28 | chmod +x dummypatch.py |
|
29 | 29 | hg clone -r0 a b |
|
30 | 30 | hg --cwd a export tip > tip.patch |
|
31 | 31 | hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch |
|
32 | 32 | cat b/a |
|
33 | 33 | rm -r b |
|
34 | 34 | |
|
35 | 35 | echo % import of plain diff should fail without message |
|
36 | 36 | hg clone -r0 a b |
|
37 | 37 | hg --cwd a diff -r0:1 > tip.patch |
|
38 | 38 | hg --cwd b import ../tip.patch |
|
39 | 39 | rm -r b |
|
40 | 40 | |
|
41 | 41 | echo % import of plain diff should be ok with message |
|
42 | 42 | hg clone -r0 a b |
|
43 | 43 | hg --cwd a diff -r0:1 > tip.patch |
|
44 | 44 | hg --cwd b import -mpatch ../tip.patch |
|
45 | 45 | rm -r b |
|
46 | 46 | |
|
47 | 47 | echo % import of plain diff with specific date and user |
|
48 | 48 | hg clone -r0 a b |
|
49 | 49 | hg --cwd a diff -r0:1 > tip.patch |
|
50 | 50 | hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch |
|
51 | 51 | hg -R b tip -pv |
|
52 | 52 | rm -r b |
|
53 | 53 | |
|
54 | 54 | echo % import of plain diff should be ok with --no-commit |
|
55 | 55 | hg clone -r0 a b |
|
56 | 56 | hg --cwd a diff -r0:1 > tip.patch |
|
57 | 57 | hg --cwd b import --no-commit ../tip.patch |
|
58 | 58 | hg --cwd b diff --nodates |
|
59 | 59 | rm -r b |
|
60 | 60 | |
|
61 | 61 | echo % hg -R repo import |
|
62 | 62 | # put the clone in a subdir - having a directory named "a" |
|
63 | 63 | # used to hide a bug. |
|
64 | 64 | mkdir dir |
|
65 | 65 | hg clone -r0 a dir/b |
|
66 | 66 | hg --cwd a export tip > dir/tip.patch |
|
67 | 67 | cd dir |
|
68 | 68 | hg -R b import tip.patch |
|
69 | 69 | cd .. |
|
70 | 70 | rm -r dir |
|
71 | 71 | |
|
72 | 72 | echo % import from stdin |
|
73 | 73 | hg clone -r0 a b |
|
74 | 74 | hg --cwd a export tip | hg --cwd b import - |
|
75 | 75 | rm -r b |
|
76 | 76 | |
|
77 | 77 | echo % import two patches in one stream |
|
78 | 78 | hg init b |
|
79 | 79 | hg --cwd a export 0:tip | hg --cwd b import - |
|
80 | 80 | hg --cwd a id |
|
81 | 81 | hg --cwd b id |
|
82 | 82 | rm -r b |
|
83 | 83 | |
|
84 | 84 | echo % override commit message |
|
85 | 85 | hg clone -r0 a b |
|
86 | 86 | hg --cwd a export tip | hg --cwd b import -m 'override' - |
|
87 | 87 | hg --cwd b tip | grep override |
|
88 | 88 | rm -r b |
|
89 | 89 | |
|
90 | 90 | cat > mkmsg.py <<EOF |
|
91 | 91 | import email.Message, sys |
|
92 | 92 | msg = email.Message.Message() |
|
93 | 93 | msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) |
|
94 | 94 | msg['Subject'] = 'email patch' |
|
95 | 95 | msg['From'] = 'email patcher' |
|
96 | 96 | sys.stdout.write(msg.as_string()) |
|
97 | 97 | EOF |
|
98 | 98 | |
|
99 | 99 | echo % plain diff in email, subject, message body |
|
100 | 100 | hg clone -r0 a b |
|
101 | 101 | hg --cwd a diff -r0:1 > tip.patch |
|
102 | 102 | python mkmsg.py > msg.patch |
|
103 | 103 | hg --cwd b import ../msg.patch |
|
104 | 104 | hg --cwd b tip | grep email |
|
105 | 105 | rm -r b |
|
106 | 106 | |
|
107 | 107 | echo % plain diff in email, no subject, message body |
|
108 | 108 | hg clone -r0 a b |
|
109 | 109 | grep -v '^Subject:' msg.patch | hg --cwd b import - |
|
110 | 110 | rm -r b |
|
111 | 111 | |
|
112 | 112 | echo % plain diff in email, subject, no message body |
|
113 | 113 | hg clone -r0 a b |
|
114 | 114 | grep -v '^email ' msg.patch | hg --cwd b import - |
|
115 | 115 | rm -r b |
|
116 | 116 | |
|
117 | 117 | echo % plain diff in email, no subject, no message body, should fail |
|
118 | 118 | hg clone -r0 a b |
|
119 | 119 | egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - |
|
120 | 120 | rm -r b |
|
121 | 121 | |
|
122 | 122 | echo % hg export in email, should use patch header |
|
123 | 123 | hg clone -r0 a b |
|
124 | 124 | hg --cwd a export tip > tip.patch |
|
125 | 125 | python mkmsg.py | hg --cwd b import - |
|
126 | 126 | hg --cwd b tip | grep second |
|
127 | 127 | rm -r b |
|
128 | 128 | |
|
129 | 129 | # subject: duplicate detection, removal of [PATCH] |
|
130 | 130 | # The '---' tests the gitsendmail handling without proper mail headers |
|
131 | 131 | cat > mkmsg2.py <<EOF |
|
132 | 132 | import email.Message, sys |
|
133 | 133 | msg = email.Message.Message() |
|
134 | 134 | msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) |
|
135 | 135 | msg['Subject'] = '[PATCH] email patch' |
|
136 | 136 | msg['From'] = 'email patcher' |
|
137 | 137 | sys.stdout.write(msg.as_string()) |
|
138 | 138 | EOF |
|
139 | 139 | |
|
140 | 140 | echo '% plain diff in email, [PATCH] subject, message body with subject' |
|
141 | 141 | hg clone -r0 a b |
|
142 | 142 | hg --cwd a diff -r0:1 > tip.patch |
|
143 | 143 | python mkmsg2.py | hg --cwd b import - |
|
144 | 144 | hg --cwd b tip --template '{desc}\n' |
|
145 | 145 | rm -r b |
|
146 | 146 | |
|
147 | 147 | # We weren't backing up the correct dirstate file when importing many patches |
|
148 | 148 | # (issue963) |
|
149 | 149 | echo '% import patch1 patch2; rollback' |
|
150 | 150 | echo line 3 >> a/a |
|
151 | 151 | hg --cwd a ci -m'third change' |
|
152 | 152 | hg --cwd a export -o '../patch%R' 1 2 |
|
153 | 153 | hg clone -qr0 a b |
|
154 | 154 | hg --cwd b parents --template 'parent: {rev}\n' |
|
155 | 155 | hg --cwd b import ../patch1 ../patch2 |
|
156 | 156 | hg --cwd b rollback |
|
157 | 157 | hg --cwd b parents --template 'parent: {rev}\n' |
|
158 | 158 | rm -r b |
|
159 | 159 | |
|
160 | 160 | # bug non regression test |
|
161 | 161 | # importing a patch in a subdirectory failed at the commit stage |
|
162 | 162 | echo line 2 >> a/d1/d2/a |
|
163 | 163 | hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' |
|
164 | 164 | echo % hg import in a subdirectory |
|
165 | 165 | hg clone -r0 a b |
|
166 | 166 | hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch |
|
167 | 167 | dir=`pwd` |
|
168 | 168 | cd b/d1/d2 2>&1 > /dev/null |
|
169 | 169 | hg import ../../../tip.patch |
|
170 | 170 | cd "$dir" |
|
171 | 171 | echo "% message should be 'subdir change'" |
|
172 | 172 | hg --cwd b tip | grep 'subdir change' |
|
173 | 173 | echo "% committer should be 'someoneelse'" |
|
174 | 174 | hg --cwd b tip | grep someoneelse |
|
175 | 175 | echo "% should be empty" |
|
176 | 176 | hg --cwd b status |
|
177 | 177 | |
|
178 | 178 | |
|
179 | 179 | # Test fuzziness (ambiguous patch location, fuzz=2) |
|
180 | 180 | echo % test fuzziness |
|
181 | 181 | hg init fuzzy |
|
182 | 182 | cd fuzzy |
|
183 | 183 | echo line1 > a |
|
184 | 184 | echo line0 >> a |
|
185 | 185 | echo line3 >> a |
|
186 | 186 | hg ci -Am adda |
|
187 | 187 | echo line1 > a |
|
188 | 188 | echo line2 >> a |
|
189 | 189 | echo line0 >> a |
|
190 | 190 | echo line3 >> a |
|
191 | 191 | hg ci -m change a |
|
192 | 192 | hg export tip > tip.patch |
|
193 | 193 | hg up -C 0 |
|
194 | 194 | echo line1 > a |
|
195 | 195 | echo line0 >> a |
|
196 | 196 | echo line1 >> a |
|
197 | 197 | echo line0 >> a |
|
198 | 198 | hg ci -m brancha |
|
199 | 199 | hg import --no-commit -v tip.patch |
|
200 | 200 | hg revert -a |
|
201 | 201 | echo '% test fuzziness with eol=auto' |
|
202 | 202 | hg --config patch.eol=auto import --no-commit -v tip.patch |
|
203 | 203 | cd .. |
|
204 | 204 | |
|
205 | 205 | # Test hunk touching empty files (issue906) |
|
206 | 206 | hg init empty |
|
207 | 207 | cd empty |
|
208 | 208 | touch a |
|
209 | 209 | touch b1 |
|
210 | 210 | touch c1 |
|
211 | 211 | echo d > d |
|
212 | 212 | hg ci -Am init |
|
213 | 213 | echo a > a |
|
214 | 214 | echo b > b1 |
|
215 | 215 | hg mv b1 b2 |
|
216 | 216 | echo c > c1 |
|
217 | 217 | hg copy c1 c2 |
|
218 | 218 | rm d |
|
219 | 219 | touch d |
|
220 | 220 | hg diff --git |
|
221 | 221 | hg ci -m empty |
|
222 | 222 | hg export --git tip > empty.diff |
|
223 | 223 | hg up -C 0 |
|
224 | 224 | hg import empty.diff |
|
225 | 225 | for name in a b1 b2 c1 c2 d; |
|
226 | 226 | do |
|
227 | 227 | echo % $name file |
|
228 | 228 | test -f $name && cat $name |
|
229 | 229 | done |
|
230 | 230 | cd .. |
|
231 | 231 | |
|
232 | 232 | # Test importing a patch ending with a binary file removal |
|
233 | 233 | echo % test trailing binary removal |
|
234 | 234 | hg init binaryremoval |
|
235 | 235 | cd binaryremoval |
|
236 | 236 | echo a > a |
|
237 | 237 | python -c "file('b', 'wb').write('a\x00b')" |
|
238 | 238 | hg ci -Am addall |
|
239 | 239 | hg rm a |
|
240 | 240 | hg rm b |
|
241 | 241 | hg st |
|
242 | 242 | hg ci -m remove |
|
243 | 243 | hg export --git . > remove.diff |
|
244 | 244 | cat remove.diff | grep git |
|
245 | 245 | hg up -C 0 |
|
246 | 246 | hg import remove.diff |
|
247 | 247 | hg manifest |
|
248 | 248 | cd .. |
|
249 | 249 | |
|
250 | 250 | echo % 'test update+rename with common name (issue 927)' |
|
251 | 251 | hg init t |
|
252 | 252 | cd t |
|
253 | 253 | touch a |
|
254 | 254 | hg ci -Am t |
|
255 | 255 | echo a > a |
|
256 | 256 | # Here, bfile.startswith(afile) |
|
257 | 257 | hg copy a a2 |
|
258 | 258 | hg ci -m copya |
|
259 | 259 | hg export --git tip > copy.diff |
|
260 | 260 | hg up -C 0 |
|
261 | 261 | hg import copy.diff |
|
262 | 262 | echo % view a |
|
263 | 263 | # a should contain an 'a' |
|
264 | 264 | cat a |
|
265 | 265 | echo % view a2 |
|
266 | 266 | # and a2 should have duplicated it |
|
267 | 267 | cat a2 |
|
268 | 268 | cd .. |
|
269 | 269 | |
|
270 | 270 | echo % 'test -p0' |
|
271 | 271 | hg init p0 |
|
272 | 272 | cd p0 |
|
273 | 273 | echo a > a |
|
274 | 274 | hg ci -Am t |
|
275 | 275 | hg import -p0 - << EOF |
|
276 | 276 | foobar |
|
277 | 277 | --- a Sat Apr 12 22:43:58 2008 -0400 |
|
278 | 278 | +++ a Sat Apr 12 22:44:05 2008 -0400 |
|
279 | 279 | @@ -1,1 +1,1 @@ |
|
280 | 280 | -a |
|
281 | 281 | +bb |
|
282 | 282 | EOF |
|
283 | 283 | hg status |
|
284 | 284 | cat a |
|
285 | 285 | cd .. |
|
286 | 286 | |
|
287 | 287 | echo % 'test paths outside repo root' |
|
288 | 288 | mkdir outside |
|
289 | 289 | touch outside/foo |
|
290 | 290 | hg init inside |
|
291 | 291 | cd inside |
|
292 | 292 | hg import - <<EOF |
|
293 | 293 | diff --git a/a b/b |
|
294 | 294 | rename from ../outside/foo |
|
295 | 295 | rename to bar |
|
296 | 296 | EOF |
|
297 | 297 | cd .. |
|
298 | 298 | |
|
299 | echo '% test import with similarity (issue295)' | |
|
299 | echo '% test import with similarity and git and strip (issue295 et al.)' | |
|
300 | 300 | hg init sim |
|
301 | 301 | cd sim |
|
302 | 302 | echo 'this is a test' > a |
|
303 | 303 | hg ci -Ama |
|
304 | 304 | cat > ../rename.diff <<EOF |
|
305 | diff --git a/a b/a | |
|
305 | diff --git a/foo/a b/foo/a | |
|
306 | 306 | deleted file mode 100644 |
|
307 | --- a/a | |
|
307 | --- a/foo/a | |
|
308 | 308 | +++ /dev/null |
|
309 | 309 | @@ -1,1 +0,0 @@ |
|
310 | 310 | -this is a test |
|
311 | diff --git a/b b/b | |
|
311 | diff --git a/foo/b b/foo/b | |
|
312 | 312 | new file mode 100644 |
|
313 | 313 | --- /dev/null |
|
314 | +++ b/b | |
|
314 | +++ b/foo/b | |
|
315 | 315 | @@ -0,0 +1,2 @@ |
|
316 | 316 | +this is a test |
|
317 | 317 | +foo |
|
318 | 318 | EOF |
|
319 | hg import --no-commit -v -s 1 ../rename.diff | |
|
319 | hg import --no-commit -v -s 1 ../rename.diff -p2 | |
|
320 | 320 | hg st -C |
|
321 | 321 | hg revert -a |
|
322 | 322 | rm b |
|
323 | hg import --no-commit -v -s 100 ../rename.diff | |
|
323 | hg import --no-commit -v -s 100 ../rename.diff -p2 | |
|
324 | 324 | hg st -C |
|
325 | 325 | cd .. |
|
326 | 326 | |
|
327 | 327 | |
|
328 | 328 | echo '% add empty file from the end of patch (issue 1495)' |
|
329 | 329 | hg init addemptyend |
|
330 | 330 | cd addemptyend |
|
331 | 331 | touch a |
|
332 | 332 | hg addremove |
|
333 | 333 | hg ci -m "commit" |
|
334 | 334 | cat > a.patch <<EOF |
|
335 | 335 | diff --git a/a b/a |
|
336 | 336 | --- a/a |
|
337 | 337 | +++ b/a |
|
338 | 338 | @@ -0,0 +1,1 @@ |
|
339 | 339 | +a |
|
340 | 340 | diff --git a/b b/b |
|
341 | 341 | new file mode 100644 |
|
342 | 342 | EOF |
|
343 | 343 | hg import --no-commit a.patch |
|
344 | 344 | cd .. |
|
345 | 345 | |
|
346 | 346 | echo '% create file when source is not /dev/null' |
|
347 | 347 | cat > create.patch <<EOF |
|
348 | 348 | diff -Naur proj-orig/foo proj-new/foo |
|
349 | 349 | --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 |
|
350 | 350 | +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
351 | 351 | @@ -0,0 +1,1 @@ |
|
352 | 352 | +a |
|
353 | 353 | EOF |
|
354 | 354 | # some people have patches like the following too |
|
355 | 355 | cat > create2.patch <<EOF |
|
356 | 356 | diff -Naur proj-orig/foo proj-new/foo |
|
357 | 357 | --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 |
|
358 | 358 | +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
|
359 | 359 | @@ -0,0 +1,1 @@ |
|
360 | 360 | +a |
|
361 | 361 | EOF |
|
362 | 362 | hg init oddcreate |
|
363 | 363 | cd oddcreate |
|
364 | 364 | hg import --no-commit ../create.patch |
|
365 | 365 | cat foo |
|
366 | 366 | rm foo |
|
367 | 367 | hg revert foo |
|
368 | 368 | hg import --no-commit ../create2.patch |
|
369 | 369 | cat foo |
|
370 | 370 | |
|
371 | 371 | echo % 'first line mistaken for email headers (issue 1859)' |
|
372 | 372 | hg init emailconfusion |
|
373 | 373 | cd emailconfusion |
|
374 | 374 | cat > a.patch <<EOF |
|
375 | 375 | module: summary |
|
376 | 376 | |
|
377 | 377 | description |
|
378 | 378 | |
|
379 | 379 | |
|
380 | 380 | diff -r 000000000000 -r 9b4c1e343b55 test.txt |
|
381 | 381 | --- /dev/null |
|
382 | 382 | +++ b/a |
|
383 | 383 | @@ -0,0 +1,1 @@ |
|
384 | 384 | +a |
|
385 | 385 | EOF |
|
386 | 386 | hg import -d '0 0' a.patch |
|
387 | 387 | hg parents -v |
|
388 | 388 | cd .. |
|
389 | 389 | |
|
390 | 390 | echo % '--- in commit message' |
|
391 | 391 | hg init commitconfusion |
|
392 | 392 | cd commitconfusion |
|
393 | 393 | cat > a.patch <<EOF |
|
394 | 394 | module: summary |
|
395 | 395 | |
|
396 | 396 | --- description |
|
397 | 397 | |
|
398 | 398 | diff --git a/a b/a |
|
399 | 399 | new file mode 100644 |
|
400 | 400 | --- /dev/null |
|
401 | 401 | +++ b/a |
|
402 | 402 | @@ -0,0 +1,1 @@ |
|
403 | 403 | +a |
|
404 | 404 | EOF |
|
405 | 405 | hg import -d '0 0' a.patch |
|
406 | 406 | hg parents -v |
|
407 | 407 | cd .. |
|
408 | 408 | |
|
409 | 409 | echo '% tricky header splitting' |
|
410 | 410 | cat > trickyheaders.patch <<EOF |
|
411 | 411 | From: User A <user@a> |
|
412 | 412 | Subject: [PATCH] from: tricky! |
|
413 | 413 | |
|
414 | 414 | # HG changeset patch |
|
415 | 415 | # User User B |
|
416 | 416 | # Date 1266264441 18000 |
|
417 | 417 | # Branch stable |
|
418 | 418 | # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 |
|
419 | 419 | # Parent 0000000000000000000000000000000000000000 |
|
420 | 420 | from: tricky! |
|
421 | 421 | |
|
422 | 422 | That is not a header. |
|
423 | 423 | |
|
424 | 424 | diff -r 000000000000 -r f2be6a1170ac foo |
|
425 | 425 | --- /dev/null |
|
426 | 426 | +++ b/foo |
|
427 | 427 | @@ -0,0 +1,1 @@ |
|
428 | 428 | +foo |
|
429 | 429 | EOF |
|
430 | 430 | |
|
431 | 431 | hg init trickyheaders |
|
432 | 432 | cd trickyheaders |
|
433 | 433 | hg import -d '0 0' ../trickyheaders.patch |
|
434 | 434 | hg export --git tip |
|
435 | 435 | cd .. |
|
436 | 436 | |
|
437 | 437 | echo '% issue2102' |
|
438 | 438 | hg init issue2102 |
|
439 | 439 | cd issue2102 |
|
440 | 440 | mkdir -p src/cmd/gc |
|
441 | 441 | touch src/cmd/gc/mksys.bash |
|
442 | 442 | hg ci -Am init |
|
443 | 443 | hg import - <<EOF |
|
444 | 444 | # HG changeset patch |
|
445 | 445 | # User Rob Pike |
|
446 | 446 | # Date 1216685449 25200 |
|
447 | 447 | # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 |
|
448 | 448 | # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 |
|
449 | 449 | help management of empty pkg and lib directories in perforce |
|
450 | 450 | |
|
451 | 451 | R=gri |
|
452 | 452 | DELTA=4 (4 added, 0 deleted, 0 changed) |
|
453 | 453 | OCL=13328 |
|
454 | 454 | CL=13328 |
|
455 | 455 | |
|
456 | 456 | diff --git a/lib/place-holder b/lib/place-holder |
|
457 | 457 | new file mode 100644 |
|
458 | 458 | --- /dev/null |
|
459 | 459 | +++ b/lib/place-holder |
|
460 | 460 | @@ -0,0 +1,2 @@ |
|
461 | 461 | +perforce does not maintain empty directories. |
|
462 | 462 | +this file helps. |
|
463 | 463 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
464 | 464 | new file mode 100644 |
|
465 | 465 | --- /dev/null |
|
466 | 466 | +++ b/pkg/place-holder |
|
467 | 467 | @@ -0,0 +1,2 @@ |
|
468 | 468 | +perforce does not maintain empty directories. |
|
469 | 469 | +this file helps. |
|
470 | 470 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
471 | 471 | old mode 100644 |
|
472 | 472 | new mode 100755 |
|
473 | 473 | EOF |
|
474 | 474 | hg sum |
|
475 | 475 | hg diff --git -c tip |
|
476 | 476 | cd .. |
|
477 | 477 | |
|
478 | 478 | echo '% diff lines looking like headers' |
|
479 | 479 | hg init difflineslikeheaders |
|
480 | 480 | cd difflineslikeheaders |
|
481 | 481 | echo a >a |
|
482 | 482 | echo b >b |
|
483 | 483 | echo c >c |
|
484 | 484 | hg ci -Am1 |
|
485 | 485 | |
|
486 | 486 | echo "key: value" >>a |
|
487 | 487 | echo "key: value" >>b |
|
488 | 488 | echo "foo" >>c |
|
489 | 489 | hg ci -m2 |
|
490 | 490 | |
|
491 | 491 | hg up -C 0 |
|
492 | 492 | hg diff --git -c1 >want |
|
493 | 493 | hg diff -c1 | hg import --no-commit - |
|
494 | 494 | hg diff --git >have |
|
495 | 495 | diff want have |
|
496 | 496 | cd .. |
|
497 | 497 |
@@ -1,381 +1,381 | |||
|
1 | 1 | adding a |
|
2 | 2 | adding d1/d2/a |
|
3 | 3 | % import exported patch |
|
4 | 4 | requesting all changes |
|
5 | 5 | adding changesets |
|
6 | 6 | adding manifests |
|
7 | 7 | adding file changes |
|
8 | 8 | added 1 changesets with 2 changes to 2 files |
|
9 | 9 | updating to branch default |
|
10 | 10 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
11 | 11 | applying ../tip.patch |
|
12 | 12 | % message should be same |
|
13 | 13 | summary: second change |
|
14 | 14 | % committer should be same |
|
15 | 15 | user: someone |
|
16 | 16 | % import exported patch with external patcher |
|
17 | 17 | requesting all changes |
|
18 | 18 | adding changesets |
|
19 | 19 | adding manifests |
|
20 | 20 | adding file changes |
|
21 | 21 | added 1 changesets with 2 changes to 2 files |
|
22 | 22 | updating to branch default |
|
23 | 23 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
24 | 24 | applying ../tip.patch |
|
25 | 25 | line2 |
|
26 | 26 | % import of plain diff should fail without message |
|
27 | 27 | requesting all changes |
|
28 | 28 | adding changesets |
|
29 | 29 | adding manifests |
|
30 | 30 | adding file changes |
|
31 | 31 | added 1 changesets with 2 changes to 2 files |
|
32 | 32 | updating to branch default |
|
33 | 33 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
34 | 34 | applying ../tip.patch |
|
35 | 35 | abort: empty commit message |
|
36 | 36 | % import of plain diff should be ok with message |
|
37 | 37 | requesting all changes |
|
38 | 38 | adding changesets |
|
39 | 39 | adding manifests |
|
40 | 40 | adding file changes |
|
41 | 41 | added 1 changesets with 2 changes to 2 files |
|
42 | 42 | updating to branch default |
|
43 | 43 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
44 | 44 | applying ../tip.patch |
|
45 | 45 | % import of plain diff with specific date and user |
|
46 | 46 | requesting all changes |
|
47 | 47 | adding changesets |
|
48 | 48 | adding manifests |
|
49 | 49 | adding file changes |
|
50 | 50 | added 1 changesets with 2 changes to 2 files |
|
51 | 51 | updating to branch default |
|
52 | 52 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
53 | 53 | applying ../tip.patch |
|
54 | 54 | changeset: 1:ca68f19f3a40 |
|
55 | 55 | tag: tip |
|
56 | 56 | user: user@nowhere.net |
|
57 | 57 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
58 | 58 | files: a |
|
59 | 59 | description: |
|
60 | 60 | patch |
|
61 | 61 | |
|
62 | 62 | |
|
63 | 63 | diff -r 80971e65b431 -r ca68f19f3a40 a |
|
64 | 64 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
65 | 65 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
66 | 66 | @@ -1,1 +1,2 @@ |
|
67 | 67 | line 1 |
|
68 | 68 | +line 2 |
|
69 | 69 | |
|
70 | 70 | % import of plain diff should be ok with --no-commit |
|
71 | 71 | requesting all changes |
|
72 | 72 | adding changesets |
|
73 | 73 | adding manifests |
|
74 | 74 | adding file changes |
|
75 | 75 | added 1 changesets with 2 changes to 2 files |
|
76 | 76 | updating to branch default |
|
77 | 77 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
78 | 78 | applying ../tip.patch |
|
79 | 79 | diff -r 80971e65b431 a |
|
80 | 80 | --- a/a |
|
81 | 81 | +++ b/a |
|
82 | 82 | @@ -1,1 +1,2 @@ |
|
83 | 83 | line 1 |
|
84 | 84 | +line 2 |
|
85 | 85 | % hg -R repo import |
|
86 | 86 | requesting all changes |
|
87 | 87 | adding changesets |
|
88 | 88 | adding manifests |
|
89 | 89 | adding file changes |
|
90 | 90 | added 1 changesets with 2 changes to 2 files |
|
91 | 91 | updating to branch default |
|
92 | 92 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
93 | 93 | applying tip.patch |
|
94 | 94 | % import from stdin |
|
95 | 95 | requesting all changes |
|
96 | 96 | adding changesets |
|
97 | 97 | adding manifests |
|
98 | 98 | adding file changes |
|
99 | 99 | added 1 changesets with 2 changes to 2 files |
|
100 | 100 | updating to branch default |
|
101 | 101 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | applying patch from stdin |
|
103 | 103 | % import two patches in one stream |
|
104 | 104 | applying patch from stdin |
|
105 | 105 | applied 80971e65b431 |
|
106 | 106 | 1d4bd90af0e4 tip |
|
107 | 107 | 1d4bd90af0e4 tip |
|
108 | 108 | % override commit message |
|
109 | 109 | requesting all changes |
|
110 | 110 | adding changesets |
|
111 | 111 | adding manifests |
|
112 | 112 | adding file changes |
|
113 | 113 | added 1 changesets with 2 changes to 2 files |
|
114 | 114 | updating to branch default |
|
115 | 115 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
116 | 116 | applying patch from stdin |
|
117 | 117 | summary: override |
|
118 | 118 | % plain diff in email, subject, message body |
|
119 | 119 | requesting all changes |
|
120 | 120 | adding changesets |
|
121 | 121 | adding manifests |
|
122 | 122 | adding file changes |
|
123 | 123 | added 1 changesets with 2 changes to 2 files |
|
124 | 124 | updating to branch default |
|
125 | 125 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
126 | 126 | applying ../msg.patch |
|
127 | 127 | user: email patcher |
|
128 | 128 | summary: email patch |
|
129 | 129 | % plain diff in email, no subject, message body |
|
130 | 130 | requesting all changes |
|
131 | 131 | adding changesets |
|
132 | 132 | adding manifests |
|
133 | 133 | adding file changes |
|
134 | 134 | added 1 changesets with 2 changes to 2 files |
|
135 | 135 | updating to branch default |
|
136 | 136 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
137 | 137 | applying patch from stdin |
|
138 | 138 | % plain diff in email, subject, no message body |
|
139 | 139 | requesting all changes |
|
140 | 140 | adding changesets |
|
141 | 141 | adding manifests |
|
142 | 142 | adding file changes |
|
143 | 143 | added 1 changesets with 2 changes to 2 files |
|
144 | 144 | updating to branch default |
|
145 | 145 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
146 | 146 | applying patch from stdin |
|
147 | 147 | % plain diff in email, no subject, no message body, should fail |
|
148 | 148 | requesting all changes |
|
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 | applying patch from stdin |
|
156 | 156 | abort: empty commit message |
|
157 | 157 | % hg export in email, should use patch header |
|
158 | 158 | requesting all changes |
|
159 | 159 | adding changesets |
|
160 | 160 | adding manifests |
|
161 | 161 | adding file changes |
|
162 | 162 | added 1 changesets with 2 changes to 2 files |
|
163 | 163 | updating to branch default |
|
164 | 164 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
165 | 165 | applying patch from stdin |
|
166 | 166 | summary: second change |
|
167 | 167 | % plain diff in email, [PATCH] subject, message body with subject |
|
168 | 168 | requesting all changes |
|
169 | 169 | adding changesets |
|
170 | 170 | adding manifests |
|
171 | 171 | adding file changes |
|
172 | 172 | added 1 changesets with 2 changes to 2 files |
|
173 | 173 | updating to branch default |
|
174 | 174 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 175 | applying patch from stdin |
|
176 | 176 | email patch |
|
177 | 177 | |
|
178 | 178 | next line |
|
179 | 179 | --- |
|
180 | 180 | % import patch1 patch2; rollback |
|
181 | 181 | parent: 0 |
|
182 | 182 | applying ../patch1 |
|
183 | 183 | applying ../patch2 |
|
184 | 184 | applied 1d4bd90af0e4 |
|
185 | 185 | rolling back to revision 1 (undo commit) |
|
186 | 186 | parent: 1 |
|
187 | 187 | % hg import in a subdirectory |
|
188 | 188 | requesting all changes |
|
189 | 189 | adding changesets |
|
190 | 190 | adding manifests |
|
191 | 191 | adding file changes |
|
192 | 192 | added 1 changesets with 2 changes to 2 files |
|
193 | 193 | updating to branch default |
|
194 | 194 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
195 | 195 | applying ../../../tip.patch |
|
196 | 196 | % message should be 'subdir change' |
|
197 | 197 | summary: subdir change |
|
198 | 198 | % committer should be 'someoneelse' |
|
199 | 199 | user: someoneelse |
|
200 | 200 | % should be empty |
|
201 | 201 | % test fuzziness |
|
202 | 202 | adding a |
|
203 | 203 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
204 | 204 | created new head |
|
205 | 205 | applying tip.patch |
|
206 | 206 | patching file a |
|
207 | 207 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). |
|
208 | 208 | reverting a |
|
209 | 209 | % test fuzziness with eol=auto |
|
210 | 210 | applying tip.patch |
|
211 | 211 | patching file a |
|
212 | 212 | Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). |
|
213 | 213 | adding a |
|
214 | 214 | adding b1 |
|
215 | 215 | adding c1 |
|
216 | 216 | adding d |
|
217 | 217 | diff --git a/a b/a |
|
218 | 218 | --- a/a |
|
219 | 219 | +++ b/a |
|
220 | 220 | @@ -0,0 +1,1 @@ |
|
221 | 221 | +a |
|
222 | 222 | diff --git a/b1 b/b2 |
|
223 | 223 | rename from b1 |
|
224 | 224 | rename to b2 |
|
225 | 225 | --- a/b1 |
|
226 | 226 | +++ b/b2 |
|
227 | 227 | @@ -0,0 +1,1 @@ |
|
228 | 228 | +b |
|
229 | 229 | diff --git a/c1 b/c1 |
|
230 | 230 | --- a/c1 |
|
231 | 231 | +++ b/c1 |
|
232 | 232 | @@ -0,0 +1,1 @@ |
|
233 | 233 | +c |
|
234 | 234 | diff --git a/c1 b/c2 |
|
235 | 235 | copy from c1 |
|
236 | 236 | copy to c2 |
|
237 | 237 | --- a/c1 |
|
238 | 238 | +++ b/c2 |
|
239 | 239 | @@ -0,0 +1,1 @@ |
|
240 | 240 | +c |
|
241 | 241 | diff --git a/d b/d |
|
242 | 242 | --- a/d |
|
243 | 243 | +++ b/d |
|
244 | 244 | @@ -1,1 +0,0 @@ |
|
245 | 245 | -d |
|
246 | 246 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
247 | 247 | applying empty.diff |
|
248 | 248 | % a file |
|
249 | 249 | a |
|
250 | 250 | % b1 file |
|
251 | 251 | % b2 file |
|
252 | 252 | b |
|
253 | 253 | % c1 file |
|
254 | 254 | c |
|
255 | 255 | % c2 file |
|
256 | 256 | c |
|
257 | 257 | % d file |
|
258 | 258 | % test trailing binary removal |
|
259 | 259 | adding a |
|
260 | 260 | adding b |
|
261 | 261 | R a |
|
262 | 262 | R b |
|
263 | 263 | diff --git a/a b/a |
|
264 | 264 | diff --git a/b b/b |
|
265 | 265 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
266 | 266 | applying remove.diff |
|
267 | 267 | % test update+rename with common name (issue 927) |
|
268 | 268 | adding a |
|
269 | 269 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
270 | 270 | applying copy.diff |
|
271 | 271 | % view a |
|
272 | 272 | a |
|
273 | 273 | % view a2 |
|
274 | 274 | a |
|
275 | 275 | % test -p0 |
|
276 | 276 | adding a |
|
277 | 277 | applying patch from stdin |
|
278 | 278 | bb |
|
279 | 279 | % test paths outside repo root |
|
280 | 280 | applying patch from stdin |
|
281 | 281 | abort: ../outside/foo not under root |
|
282 | % test import with similarity (issue295) | |
|
282 | % test import with similarity and git and strip (issue295 et al.) | |
|
283 | 283 | adding a |
|
284 | 284 | applying ../rename.diff |
|
285 | 285 | patching file a |
|
286 | 286 | patching file b |
|
287 | 287 | removing a |
|
288 | 288 | adding b |
|
289 | 289 | recording removal of a as rename to b (88% similar) |
|
290 | 290 | A b |
|
291 | 291 | a |
|
292 | 292 | R a |
|
293 | 293 | undeleting a |
|
294 | 294 | forgetting b |
|
295 | 295 | applying ../rename.diff |
|
296 | 296 | patching file a |
|
297 | 297 | patching file b |
|
298 | 298 | removing a |
|
299 | 299 | adding b |
|
300 | 300 | A b |
|
301 | 301 | R a |
|
302 | 302 | % add empty file from the end of patch (issue 1495) |
|
303 | 303 | adding a |
|
304 | 304 | applying a.patch |
|
305 | 305 | % create file when source is not /dev/null |
|
306 | 306 | applying ../create.patch |
|
307 | 307 | a |
|
308 | 308 | applying ../create2.patch |
|
309 | 309 | a |
|
310 | 310 | % first line mistaken for email headers (issue 1859) |
|
311 | 311 | applying a.patch |
|
312 | 312 | changeset: 0:5a681217c0ad |
|
313 | 313 | tag: tip |
|
314 | 314 | user: test |
|
315 | 315 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
316 | 316 | files: a |
|
317 | 317 | description: |
|
318 | 318 | module: summary |
|
319 | 319 | |
|
320 | 320 | description |
|
321 | 321 | |
|
322 | 322 | |
|
323 | 323 | % --- in commit message |
|
324 | 324 | applying a.patch |
|
325 | 325 | changeset: 0:f34d9187897d |
|
326 | 326 | tag: tip |
|
327 | 327 | user: test |
|
328 | 328 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
329 | 329 | files: a |
|
330 | 330 | description: |
|
331 | 331 | module: summary |
|
332 | 332 | |
|
333 | 333 | |
|
334 | 334 | % tricky header splitting |
|
335 | 335 | applying ../trickyheaders.patch |
|
336 | 336 | # HG changeset patch |
|
337 | 337 | # User User B |
|
338 | 338 | # Date 0 0 |
|
339 | 339 | # Node ID eb56ab91903632294ac504838508cb370c0901d2 |
|
340 | 340 | # Parent 0000000000000000000000000000000000000000 |
|
341 | 341 | from: tricky! |
|
342 | 342 | |
|
343 | 343 | That is not a header. |
|
344 | 344 | |
|
345 | 345 | diff --git a/foo b/foo |
|
346 | 346 | new file mode 100644 |
|
347 | 347 | --- /dev/null |
|
348 | 348 | +++ b/foo |
|
349 | 349 | @@ -0,0 +1,1 @@ |
|
350 | 350 | +foo |
|
351 | 351 | % issue2102 |
|
352 | 352 | adding src/cmd/gc/mksys.bash |
|
353 | 353 | applying patch from stdin |
|
354 | 354 | parent: 1:d59915696727 tip |
|
355 | 355 | help management of empty pkg and lib directories in perforce |
|
356 | 356 | branch: default |
|
357 | 357 | commit: (clean) |
|
358 | 358 | update: (current) |
|
359 | 359 | diff --git a/lib/place-holder b/lib/place-holder |
|
360 | 360 | new file mode 100644 |
|
361 | 361 | --- /dev/null |
|
362 | 362 | +++ b/lib/place-holder |
|
363 | 363 | @@ -0,0 +1,2 @@ |
|
364 | 364 | +perforce does not maintain empty directories. |
|
365 | 365 | +this file helps. |
|
366 | 366 | diff --git a/pkg/place-holder b/pkg/place-holder |
|
367 | 367 | new file mode 100644 |
|
368 | 368 | --- /dev/null |
|
369 | 369 | +++ b/pkg/place-holder |
|
370 | 370 | @@ -0,0 +1,2 @@ |
|
371 | 371 | +perforce does not maintain empty directories. |
|
372 | 372 | +this file helps. |
|
373 | 373 | diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
|
374 | 374 | old mode 100644 |
|
375 | 375 | new mode 100755 |
|
376 | 376 | % diff lines looking like headers |
|
377 | 377 | adding a |
|
378 | 378 | adding b |
|
379 | 379 | adding c |
|
380 | 380 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
381 | 381 | applying patch from stdin |
General Comments 0
You need to be logged in to leave comments.
Login now