| 1 |
$ hg init repo |
| 2 |
$ cd repo |
| 3 |
|
| 4 |
New file: |
| 5 |
|
| 6 |
$ hg import -d "1000000 0" -mnew - <<EOF |
| 7 |
> diff --git a/new b/new |
| 8 |
> new file mode 100644 |
| 9 |
> index 0000000..7898192 |
| 10 |
> --- /dev/null |
| 11 |
> +++ b/new |
| 12 |
> @@ -0,0 +1 @@ |
| 13 |
> +a |
| 14 |
> EOF |
| 15 |
applying patch from stdin |
| 16 |
|
| 17 |
$ hg tip -q |
| 18 |
0:ae3ee40d2079 |
| 19 |
|
| 20 |
New empty file: |
| 21 |
|
| 22 |
$ hg import -d "1000000 0" -mempty - <<EOF |
| 23 |
> diff --git a/empty b/empty |
| 24 |
> new file mode 100644 |
| 25 |
> EOF |
| 26 |
applying patch from stdin |
| 27 |
|
| 28 |
$ hg tip -q |
| 29 |
1:ab199dc869b5 |
| 30 |
|
| 31 |
$ hg locate empty |
| 32 |
empty |
| 33 |
|
| 34 |
chmod +x: |
| 35 |
|
| 36 |
$ hg import -d "1000000 0" -msetx - <<EOF |
| 37 |
> diff --git a/new b/new |
| 38 |
> old mode 100644 |
| 39 |
> new mode 100755 |
| 40 |
> EOF |
| 41 |
applying patch from stdin |
| 42 |
|
| 43 |
#if execbit |
| 44 |
$ hg tip -q |
| 45 |
2:3a34410f282e |
| 46 |
$ test -x new |
| 47 |
$ hg rollback -q |
| 48 |
#else |
| 49 |
$ hg tip -q |
| 50 |
1:ab199dc869b5 |
| 51 |
#endif |
| 52 |
|
| 53 |
Copy and removing x bit: |
| 54 |
|
| 55 |
$ hg import -f -d "1000000 0" -mcopy - <<EOF |
| 56 |
> diff --git a/new b/copy |
| 57 |
> old mode 100755 |
| 58 |
> new mode 100644 |
| 59 |
> similarity index 100% |
| 60 |
> copy from new |
| 61 |
> copy to copy |
| 62 |
> diff --git a/new b/copyx |
| 63 |
> similarity index 100% |
| 64 |
> copy from new |
| 65 |
> copy to copyx |
| 66 |
> EOF |
| 67 |
applying patch from stdin |
| 68 |
|
| 69 |
$ test -f copy |
| 70 |
#if execbit |
| 71 |
$ test ! -x copy |
| 72 |
$ test -x copyx |
| 73 |
$ hg tip -q |
| 74 |
2:21dfaae65c71 |
| 75 |
#else |
| 76 |
$ hg tip -q |
| 77 |
2:0efdaa8e3bf3 |
| 78 |
#endif |
| 79 |
|
| 80 |
$ hg up -qCr1 |
| 81 |
$ hg rollback -q |
| 82 |
|
| 83 |
Copy (like above but independent of execbit): |
| 84 |
|
| 85 |
$ hg import -d "1000000 0" -mcopy - <<EOF |
| 86 |
> diff --git a/new b/copy |
| 87 |
> similarity index 100% |
| 88 |
> copy from new |
| 89 |
> copy to copy |
| 90 |
> diff --git a/new b/copyx |
| 91 |
> similarity index 100% |
| 92 |
> copy from new |
| 93 |
> copy to copyx |
| 94 |
> EOF |
| 95 |
applying patch from stdin |
| 96 |
|
| 97 |
$ hg tip -q |
| 98 |
2:0efdaa8e3bf3 |
| 99 |
$ test -f copy |
| 100 |
|
| 101 |
$ cat copy |
| 102 |
a |
| 103 |
|
| 104 |
$ hg cat copy |
| 105 |
a |
| 106 |
|
| 107 |
Rename: |
| 108 |
|
| 109 |
$ hg import -d "1000000 0" -mrename - <<EOF |
| 110 |
> diff --git a/copy b/rename |
| 111 |
> similarity index 100% |
| 112 |
> rename from copy |
| 113 |
> rename to rename |
| 114 |
> EOF |
| 115 |
applying patch from stdin |
| 116 |
|
| 117 |
$ hg tip -q |
| 118 |
3:b1f57753fad2 |
| 119 |
|
| 120 |
$ hg locate |
| 121 |
copyx |
| 122 |
empty |
| 123 |
new |
| 124 |
rename |
| 125 |
|
| 126 |
Delete: |
| 127 |
|
| 128 |
$ hg import -d "1000000 0" -mdelete - <<EOF |
| 129 |
> diff --git a/copyx b/copyx |
| 130 |
> deleted file mode 100755 |
| 131 |
> index 7898192..0000000 |
| 132 |
> --- a/copyx |
| 133 |
> +++ /dev/null |
| 134 |
> @@ -1 +0,0 @@ |
| 135 |
> -a |
| 136 |
> EOF |
| 137 |
applying patch from stdin |
| 138 |
|
| 139 |
$ hg tip -q |
| 140 |
4:1bd1da94b9b2 |
| 141 |
|
| 142 |
$ hg locate |
| 143 |
empty |
| 144 |
new |
| 145 |
rename |
| 146 |
|
| 147 |
$ test -f copyx |
| 148 |
[1] |
| 149 |
|
| 150 |
Regular diff: |
| 151 |
|
| 152 |
$ hg import -d "1000000 0" -mregular - <<EOF |
| 153 |
> diff --git a/rename b/rename |
| 154 |
> index 7898192..72e1fe3 100644 |
| 155 |
> --- a/rename |
| 156 |
> +++ b/rename |
| 157 |
> @@ -1 +1,5 @@ |
| 158 |
> a |
| 159 |
> +a |
| 160 |
> +a |
| 161 |
> +a |
| 162 |
> +a |
| 163 |
> EOF |
| 164 |
applying patch from stdin |
| 165 |
|
| 166 |
$ hg tip -q |
| 167 |
5:46fe99cb3035 |
| 168 |
|
| 169 |
Copy and modify: |
| 170 |
|
| 171 |
$ hg import -d "1000000 0" -mcopymod - <<EOF |
| 172 |
> diff --git a/rename b/copy2 |
| 173 |
> similarity index 80% |
| 174 |
> copy from rename |
| 175 |
> copy to copy2 |
| 176 |
> index 72e1fe3..b53c148 100644 |
| 177 |
> --- a/rename |
| 178 |
> +++ b/copy2 |
| 179 |
> @@ -1,5 +1,5 @@ |
| 180 |
> a |
| 181 |
> a |
| 182 |
> -a |
| 183 |
> +b |
| 184 |
> a |
| 185 |
> a |
| 186 |
> EOF |
| 187 |
applying patch from stdin |
| 188 |
|
| 189 |
$ hg tip -q |
| 190 |
6:ffeb3197c12d |
| 191 |
|
| 192 |
$ hg cat copy2 |
| 193 |
a |
| 194 |
a |
| 195 |
b |
| 196 |
a |
| 197 |
a |
| 198 |
|
| 199 |
Rename and modify: |
| 200 |
|
| 201 |
$ hg import -d "1000000 0" -mrenamemod - <<EOF |
| 202 |
> diff --git a/copy2 b/rename2 |
| 203 |
> similarity index 80% |
| 204 |
> rename from copy2 |
| 205 |
> rename to rename2 |
| 206 |
> index b53c148..8f81e29 100644 |
| 207 |
> --- a/copy2 |
| 208 |
> +++ b/rename2 |
| 209 |
> @@ -1,5 +1,5 @@ |
| 210 |
> a |
| 211 |
> a |
| 212 |
> b |
| 213 |
> -a |
| 214 |
> +c |
| 215 |
> a |
| 216 |
> EOF |
| 217 |
applying patch from stdin |
| 218 |
|
| 219 |
$ hg tip -q |
| 220 |
7:401aede9e6bb |
| 221 |
|
| 222 |
$ hg locate copy2 |
| 223 |
[1] |
| 224 |
$ hg cat rename2 |
| 225 |
a |
| 226 |
a |
| 227 |
b |
| 228 |
c |
| 229 |
a |
| 230 |
|
| 231 |
One file renamed multiple times: |
| 232 |
|
| 233 |
$ hg import -d "1000000 0" -mmultirenames - <<EOF |
| 234 |
> diff --git a/rename2 b/rename3 |
| 235 |
> rename from rename2 |
| 236 |
> rename to rename3 |
| 237 |
> diff --git a/rename2 b/rename3-2 |
| 238 |
> rename from rename2 |
| 239 |
> rename to rename3-2 |
| 240 |
> EOF |
| 241 |
applying patch from stdin |
| 242 |
|
| 243 |
$ hg tip -q |
| 244 |
8:2ef727e684e8 |
| 245 |
|
| 246 |
$ hg log -vr. --template '{rev} {files} / {file_copies}\n' |
| 247 |
8 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2) |
| 248 |
|
| 249 |
$ hg locate rename2 rename3 rename3-2 |
| 250 |
rename3 |
| 251 |
rename3-2 |
| 252 |
|
| 253 |
$ hg cat rename3 |
| 254 |
a |
| 255 |
a |
| 256 |
b |
| 257 |
c |
| 258 |
a |
| 259 |
|
| 260 |
$ hg cat rename3-2 |
| 261 |
a |
| 262 |
a |
| 263 |
b |
| 264 |
c |
| 265 |
a |
| 266 |
|
| 267 |
$ echo foo > foo |
| 268 |
$ hg add foo |
| 269 |
$ hg ci -m 'add foo' |
| 270 |
|
| 271 |
Binary files and regular patch hunks: |
| 272 |
|
| 273 |
$ hg import -d "1000000 0" -m binaryregular - <<EOF |
| 274 |
> diff --git a/binary b/binary |
| 275 |
> new file mode 100644 |
| 276 |
> index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
| 277 |
> GIT binary patch |
| 278 |
> literal 4 |
| 279 |
> Lc\${NkU|;|M00aO5 |
| 280 |
> |
| 281 |
> diff --git a/foo b/foo2 |
| 282 |
> rename from foo |
| 283 |
> rename to foo2 |
| 284 |
> EOF |
| 285 |
applying patch from stdin |
| 286 |
|
| 287 |
$ hg tip -q |
| 288 |
10:27377172366e |
| 289 |
|
| 290 |
$ cat foo2 |
| 291 |
foo |
| 292 |
|
| 293 |
$ hg manifest --debug | grep binary |
| 294 |
045c85ba38952325e126c70962cc0f9d9077bc67 644 binary |
| 295 |
|
| 296 |
Multiple binary files: |
| 297 |
|
| 298 |
$ hg import -d "1000000 0" -m multibinary - <<EOF |
| 299 |
> diff --git a/mbinary1 b/mbinary1 |
| 300 |
> new file mode 100644 |
| 301 |
> index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
| 302 |
> GIT binary patch |
| 303 |
> literal 4 |
| 304 |
> Lc\${NkU|;|M00aO5 |
| 305 |
> |
| 306 |
> diff --git a/mbinary2 b/mbinary2 |
| 307 |
> new file mode 100644 |
| 308 |
> index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490 |
| 309 |
> GIT binary patch |
| 310 |
> literal 5 |
| 311 |
> Mc\${NkU|\`?^000jF3jhEB |
| 312 |
> |
| 313 |
> EOF |
| 314 |
applying patch from stdin |
| 315 |
|
| 316 |
$ hg tip -q |
| 317 |
11:18b73a84b4ab |
| 318 |
|
| 319 |
$ hg manifest --debug | grep mbinary |
| 320 |
045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1 |
| 321 |
a874b471193996e7cb034bb301cac7bdaf3e3f46 644 mbinary2 |
| 322 |
|
| 323 |
Binary file and delta hunk (we build the patch using this sed hack to |
| 324 |
avoid an unquoted ^, which check-code says breaks sh on Solaris): |
| 325 |
|
| 326 |
$ sed 's/ caret /^/g;s/ dollarparen /$(/g' > quote-hack.patch <<'EOF' |
| 327 |
> diff --git a/delta b/delta |
| 328 |
> new file mode 100644 |
| 329 |
> index 0000000000000000000000000000000000000000..8c9b7831b231c2600843e303e66b521353a200b3 |
| 330 |
> GIT binary patch |
| 331 |
> literal 3749 |
| 332 |
> zcmV;W4qEYvP)<h;3K|Lk000e1NJLTq006iE002D*0ssI2kt{U(0000PbVXQnQ*UN; |
| 333 |
> zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU=M@d9MRCwC#oC!>o#}>x{(W-y~UN*tK |
| 334 |
> z%A%sxiUy2Ys)0Vm#ueArYKoYqX;GuiqZpgirM6nCVoYk?YNAz3G~z;BZ~@~&OQEe4 |
| 335 |
> zmGvS5isFJI;Pd_7J+EKxyHZeu` caret t4r2>F;h-+VK3{_{WoGv8dSpFDYDrA%3UX03pt |
| 336 |
> zOaVoi0*W#P6lDr1$`nwPDWE7*rhuYM0Y#YtiZTThWeO<D6i}2YpqR<%$s>bRRaI42 |
| 337 |
> zS3iFIxJ8Q=EnBv1Z7?pBw_bLjJb3V+tgP(Tty_2R-mR#p04x78n2n7MSOFyt4i1iv |
| 338 |
> zjxH`PPEJmgD7U?IK&h;(EGQ@_DJc<@01=4fiNXHcKZ8LhZQ8T}E3U4tUS3}OrcgQW |
| 339 |
> zWdX{K8#l7Ev&#$ysR)G#0*rC+<WGZ3?CtG4bm-ve>Dj$|_qJ`@D*stNP_AFUe&x!Q |
| 340 |
> zJ9q9B7Z=ym)MyZ?Tg1ROunUYr81nV?B@!tYS~5_|%gfW#(_s<4UN1!Q?Dv8d>g#m6 |
| 341 |
> z%*@R2@bI2JdnzxQ!EDU`$eQY!tgI~Zn$prz;gaXNod5*5p(1Bz=P$qfvZ$y?dC@X~ |
| 342 |
> zlAD+NAKhB{=;6bMwzjqn>9mavvKOGd`s%A+fBiL>Q;xJWpa72C+}u{JTHUX>{~}Qj |
| 343 |
> zUb%hyHgN~c?cBLjInvUALMD9g-aXt54ZL8AOCvXL-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mqoSgq&06adp5T=U |
| 371 |
> z6DH*4=AB7C1D9Amu?ia-wtxSAlmTEO96XHx)-+rKP;ip$pukuSJGW3P1aUmc2yo%) |
| 372 |
> z&<t3F>d1X+1qzaag-%x+eKHx{?Afz3GBQSw9u0lw<mB+I#v11TKRpKWQS+lvVL7=u |
| 373 |
> zHr6)1ynEF<i3kO6A8&ppPMo-F=PnWfXkSj@i*7J6C<F}wR?s(O0niC?t+6;+k}pPq |
| 374 |
> zrok&TPU40rL0ZYDwenNrrmPZ`gjo@DEF`7 caret cKP||pUr;+r)hyn9O37=xA`3%Bj-ih |
| 375 |
> z+1usk<%5G-y+R?tA`qY=)6&vNjL{P?QzHg%P%>`ZxP=QB%DHY6L26?36V_p caret {}n$q |
| 376 |
> z3@9W=KmGI*Ng_Q#AzA%-z|Z caret |#oW(hkfgpuS$RKRhlrarX%efMMCs}GLChec5+y{6 |
| 377 |
> z1Qnxim_C-fmQuaAK_NUHUBV&;1c0V)wji<RcdZ*aAWTwyt>hVnlt caret asFCe0&a@tqp |
| 378 |
> zEEy;$L}D$X6)wfQNl8gu6Z>oB3_RrP=gTyK2@@w#LbQfLNHj>Q&z(C5wUFhK+}0aV |
| 379 |
> zSohlc=7K+spN<ctf}5KgKqNyJDNP9;LZd)nTE=9|6Xdr9%Hzk63-tL2c9FD*rsyYY |
| 380 |
> z!}t+Yljq7-p$X;4_YL?6d;mdY3R##o1e%rlPxrsMh8|;sKTr~ caret QD#sw3&vS$FwlTk |
| 381 |
> zp1#Gw!Qo-$LtvpXt#ApV0g) caret F=qFB`VB!W297x=$mr<$>rco3v$QKih_xN!k6;M=@ |
| 382 |
> zCr?gDNQj7tm@;JwD;Ty&NlBSCYZk(b3dZeN8D4h2{r20dSFc7;(>E&r`s=TVtzpB4 |
| 383 |
> zk+ caret N&zCAiRns(?p6iBlk9v&h{1ve(FNtc)td51M>)TkXhc6{>5C)`fS$&)A1*CP1% |
| 384 |
> zld+peue4aYbg3C0!+4mu+}vE caret j_feX+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|
| 398 |
> zA?R$|wvC+m caret Ups=*(4lDh*=UN8{5h(A?p#D caret 2N$8u4Z55!q?ZAh(iEEng9_Zi>IgO |
| 399 |
> z#~**JC8hE4@n{hO&8btT5F*?nC_%LhA3i)PDhh-pB_&1wGrDIl caret *=8x3n&;akBf caret - |
| 400 |
> zJd&86kq$%%907v caret tgWoQdwI`|oNK%VvU~S#C<o caret F?6c48?Cjj#-4P<>HFD%&|Ni~t |
| 401 |
> zKJ(|#H`$<5W+6ZkBb213rXonKZLB+X> caret L}J@W6osP3piLD_5?R!`S}*{xLBzFiL4@ |
| 402 |
> zX+}l{`A%?f@T5tT%ztu60p;)be`fWC`tP@WpO=?cpf8Xuf1OSj6d3f@Ki(ovDYq%0 |
| 403 |
> z{4ZSe`kOay5@=lAT!}vFzxyemC{sXDrhuYM0Y#ZI1r%ipD9W11{w=@&xgJ}t2x;ep |
| 404 |
> P00000NkvXXu0mjfZ5|Er |
| 405 |
> |
| 406 |
> literal 0 |
| 407 |
> HcmV?d00001 |
| 408 |
> |
| 409 |
> EOF |
| 410 |
$ hg import -d "1000000 0" -m delta quote-hack.patch |
| 411 |
applying quote-hack.patch |
| 412 |
$ rm quote-hack.patch |
| 413 |
|
| 414 |
$ hg manifest --debug | grep delta |
| 415 |
9600f98bb60ce732634d126aaa4ac1ec959c573e 644 delta |
| 416 |
|
| 417 |
$ hg import -d "1000000 0" -m delta - <<'EOF' |
| 418 |
> diff --git a/delta b/delta |
| 419 |
> index 8c9b7831b231c2600843e303e66b521353a200b3..0021dd95bc0dba53c39ce81377126d43731d68df 100644 |
| 420 |
> GIT binary patch |
| 421 |
> delta 49 |
| 422 |
> zcmZ1~yHs|=21Z8J$r~9bFdA-lVv=EEw4WT$qRf2QSa5SIOAHI6(&k4T8H|kLo4vWB |
| 423 |
> FSO9ZT4bA`n |
| 424 |
> |
| 425 |
> delta 49 |
| 426 |
> zcmV-10M7rV9i<(xumJ(}ld%Di0Xefm0vrMXpOaq%BLm9I%d>?9Tm%6Vv*HM70RcC& |
| 427 |
> HOA1;9yU-AD |
| 428 |
> |
| 429 |
> EOF |
| 430 |
applying patch from stdin |
| 431 |
|
| 432 |
$ hg manifest --debug | grep delta |
| 433 |
56094bbea136dcf8dbd4088f6af469bde1a98b75 644 delta |
| 434 |
|
| 435 |
Filenames with spaces: |
| 436 |
|
| 437 |
$ sed 's,EOL$,,g' <<EOF | hg import -d "1000000 0" -m spaces - |
| 438 |
> diff --git a/foo bar b/foo bar |
| 439 |
> new file mode 100644 |
| 440 |
> index 0000000..257cc56 |
| 441 |
> --- /dev/null |
| 442 |
> +++ b/foo bar EOL |
| 443 |
> @@ -0,0 +1 @@ |
| 444 |
> +foo |
| 445 |
> EOF |
| 446 |
applying patch from stdin |
| 447 |
|
| 448 |
$ hg tip -q |
| 449 |
14:4b79479c9a6d |
| 450 |
|
| 451 |
$ cat "foo bar" |
| 452 |
foo |
| 453 |
|
| 454 |
Copy then modify the original file: |
| 455 |
|
| 456 |
$ hg import -d "1000000 0" -m copy-mod-orig - <<EOF |
| 457 |
> diff --git a/foo2 b/foo2 |
| 458 |
> index 257cc56..fe08ec6 100644 |
| 459 |
> --- a/foo2 |
| 460 |
> +++ b/foo2 |
| 461 |
> @@ -1 +1,2 @@ |
| 462 |
> foo |
| 463 |
> +new line |
| 464 |
> diff --git a/foo2 b/foo3 |
| 465 |
> similarity index 100% |
| 466 |
> copy from foo2 |
| 467 |
> copy to foo3 |
| 468 |
> EOF |
| 469 |
applying patch from stdin |
| 470 |
|
| 471 |
$ hg tip -q |
| 472 |
15:9cbe44af4ae9 |
| 473 |
|
| 474 |
$ cat foo3 |
| 475 |
foo |
| 476 |
|
| 477 |
Move text file and patch as binary |
| 478 |
|
| 479 |
$ echo a > text2 |
| 480 |
$ hg ci -Am0 |
| 481 |
adding text2 |
| 482 |
$ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" |
| 483 |
> diff --git a/text2 b/binary2 |
| 484 |
> rename from text2 |
| 485 |
> rename to binary2 |
| 486 |
> index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
| 487 |
> GIT binary patch |
| 488 |
> literal 5 |
| 489 |
> Mc$`b*O5$Pw00T?_*Z=?k |
| 490 |
> |
| 491 |
> EOF |
| 492 |
applying patch from stdin |
| 493 |
|
| 494 |
$ cat binary2 |
| 495 |
a |
| 496 |
b |
| 497 |
\x00 (no-eol) (esc) |
| 498 |
|
| 499 |
$ hg st --copies --change . |
| 500 |
A binary2 |
| 501 |
text2 |
| 502 |
R text2 |
| 503 |
|
| 504 |
Invalid base85 content |
| 505 |
|
| 506 |
$ hg rollback |
| 507 |
repository tip rolled back to revision 16 (undo import) |
| 508 |
working directory now based on revision 16 |
| 509 |
$ hg revert -aq |
| 510 |
$ hg import -d "1000000 0" -m invalid-binary - <<"EOF" |
| 511 |
> diff --git a/text2 b/binary2 |
| 512 |
> rename from text2 |
| 513 |
> rename to binary2 |
| 514 |
> index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
| 515 |
> GIT binary patch |
| 516 |
> literal 5 |
| 517 |
> Mc$`b*O.$Pw00T?_*Z=?k |
| 518 |
> |
| 519 |
> EOF |
| 520 |
applying patch from stdin |
| 521 |
abort: could not decode "binary2" binary patch: bad base85 character at position 6 |
| 522 |
(check that whitespace in the patch has not been mangled) |
| 523 |
[10] |
| 524 |
|
| 525 |
$ hg revert -aq |
| 526 |
$ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" |
| 527 |
> diff --git a/text2 b/binary2 |
| 528 |
> rename from text2 |
| 529 |
> rename to binary2 |
| 530 |
> index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
| 531 |
> GIT binary patch |
| 532 |
> literal 6 |
| 533 |
> Mc$`b*O5$Pw00T?_*Z=?k |
| 534 |
> |
| 535 |
> EOF |
| 536 |
applying patch from stdin |
| 537 |
abort: "binary2" length is 5 bytes, should be 6 |
| 538 |
(check that whitespace in the patch has not been mangled) |
| 539 |
[10] |
| 540 |
|
| 541 |
$ hg revert -aq |
| 542 |
$ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" |
| 543 |
> diff --git a/text2 b/binary2 |
| 544 |
> rename from text2 |
| 545 |
> rename to binary2 |
| 546 |
> index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
| 547 |
> GIT binary patch |
| 548 |
> Mc$`b*O5$Pw00T?_*Z=?k |
| 549 |
> |
| 550 |
> EOF |
| 551 |
applying patch from stdin |
| 552 |
abort: could not extract "binary2" binary data |
| 553 |
(check that whitespace in the patch has not been mangled) |
| 554 |
[10] |
| 555 |
|
| 556 |
Simulate a copy/paste turning LF into CRLF (issue2870) |
| 557 |
|
| 558 |
$ hg revert -aq |
| 559 |
$ cat > binary.diff <<"EOF" |
| 560 |
> diff --git a/text2 b/binary2 |
| 561 |
> rename from text2 |
| 562 |
> rename to binary2 |
| 563 |
> index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 |
| 564 |
> GIT binary patch |
| 565 |
> literal 5 |
| 566 |
> Mc$`b*O5$Pw00T?_*Z=?k |
| 567 |
> |
| 568 |
> EOF |
| 569 |
>>> fp = open('binary.diff', 'rb') |
| 570 |
>>> data = fp.read() |
| 571 |
>>> fp.close() |
| 572 |
>>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n')) and None |
| 573 |
$ rm binary2 |
| 574 |
$ hg import --no-commit binary.diff |
| 575 |
applying binary.diff |
| 576 |
|
| 577 |
$ cd .. |
| 578 |
|
| 579 |
Consecutive import with renames (issue2459) |
| 580 |
|
| 581 |
$ hg init issue2459 |
| 582 |
$ cd issue2459 |
| 583 |
$ hg import --no-commit --force - <<EOF |
| 584 |
> diff --git a/a b/a |
| 585 |
> new file mode 100644 |
| 586 |
> EOF |
| 587 |
applying patch from stdin |
| 588 |
$ hg import --no-commit --force - <<EOF |
| 589 |
> diff --git a/a b/b |
| 590 |
> rename from a |
| 591 |
> rename to b |
| 592 |
> EOF |
| 593 |
applying patch from stdin |
| 594 |
a has not been committed yet, so no copy data will be stored for b. |
| 595 |
$ hg debugstate |
| 596 |
a 0 -1 unset b |
| 597 |
$ hg ci -m done |
| 598 |
$ cd .. |
| 599 |
|
| 600 |
Renames and strip |
| 601 |
|
| 602 |
$ hg init renameandstrip |
| 603 |
$ cd renameandstrip |
| 604 |
$ echo a > a |
| 605 |
$ hg ci -Am adda |
| 606 |
adding a |
| 607 |
$ hg import --no-commit -p2 - <<EOF |
| 608 |
> diff --git a/foo/a b/foo/b |
| 609 |
> rename from foo/a |
| 610 |
> rename to foo/b |
| 611 |
> EOF |
| 612 |
applying patch from stdin |
| 613 |
$ hg st --copies |
| 614 |
A b |
| 615 |
a |
| 616 |
R a |
| 617 |
|
| 618 |
Prefix with strip, renames, creates etc |
| 619 |
|
| 620 |
$ hg revert -aC |
| 621 |
forgetting b |
| 622 |
undeleting a |
| 623 |
$ rm b |
| 624 |
$ mkdir -p dir/dir2 |
| 625 |
$ echo b > dir/dir2/b |
| 626 |
$ echo c > dir/dir2/c |
| 627 |
$ echo d > dir/d |
| 628 |
$ hg ci -Am addbcd |
| 629 |
adding dir/d |
| 630 |
adding dir/dir2/b |
| 631 |
adding dir/dir2/c |
| 632 |
|
| 633 |
prefix '.' is the same as no prefix |
| 634 |
$ hg import --no-commit --prefix . - <<EOF |
| 635 |
> diff --git a/dir/a b/dir/a |
| 636 |
> --- /dev/null |
| 637 |
> +++ b/dir/a |
| 638 |
> @@ -0,0 +1 @@ |
| 639 |
> +aaaa |
| 640 |
> diff --git a/dir/d b/dir/d |
| 641 |
> --- a/dir/d |
| 642 |
> +++ b/dir/d |
| 643 |
> @@ -1,1 +1,2 @@ |
| 644 |
> d |
| 645 |
> +dddd |
| 646 |
> EOF |
| 647 |
applying patch from stdin |
| 648 |
$ cat dir/a |
| 649 |
aaaa |
| 650 |
$ cat dir/d |
| 651 |
d |
| 652 |
dddd |
| 653 |
$ hg revert -aC |
| 654 |
forgetting dir/a |
| 655 |
reverting dir/d |
| 656 |
$ rm dir/a |
| 657 |
|
| 658 |
prefix with default strip |
| 659 |
$ hg import --no-commit --prefix dir/ - <<EOF |
| 660 |
> diff --git a/a b/a |
| 661 |
> --- /dev/null |
| 662 |
> +++ b/a |
| 663 |
> @@ -0,0 +1 @@ |
| 664 |
> +aaa |
| 665 |
> diff --git a/d b/d |
| 666 |
> --- a/d |
| 667 |
> +++ b/d |
| 668 |
> @@ -1,1 +1,2 @@ |
| 669 |
> d |
| 670 |
> +dd |
| 671 |
> EOF |
| 672 |
applying patch from stdin |
| 673 |
$ cat dir/a |
| 674 |
aaa |
| 675 |
$ cat dir/d |
| 676 |
d |
| 677 |
dd |
| 678 |
$ hg revert -aC |
| 679 |
forgetting dir/a |
| 680 |
reverting dir/d |
| 681 |
$ rm dir/a |
| 682 |
(test that prefixes are relative to the cwd) |
| 683 |
$ mkdir tmpdir |
| 684 |
$ cd tmpdir |
| 685 |
$ hg import --no-commit -p2 --prefix ../dir/ - <<EOF |
| 686 |
> diff --git a/foo/a b/foo/a |
| 687 |
> new file mode 100644 |
| 688 |
> --- /dev/null |
| 689 |
> +++ b/foo/a |
| 690 |
> @@ -0,0 +1 @@ |
| 691 |
> +a |
| 692 |
> diff --git a/foo/dir2/b b/foo/dir2/b2 |
| 693 |
> rename from foo/dir2/b |
| 694 |
> rename to foo/dir2/b2 |
| 695 |
> diff --git a/foo/dir2/c b/foo/dir2/c |
| 696 |
> --- a/foo/dir2/c |
| 697 |
> +++ b/foo/dir2/c |
| 698 |
> @@ -0,0 +1 @@ |
| 699 |
> +cc |
| 700 |
> diff --git a/foo/d b/foo/d |
| 701 |
> deleted file mode 100644 |
| 702 |
> --- a/foo/d |
| 703 |
> +++ /dev/null |
| 704 |
> @@ -1,1 +0,0 @@ |
| 705 |
> -d |
| 706 |
> EOF |
| 707 |
applying patch from stdin |
| 708 |
$ hg st --copies |
| 709 |
M dir/dir2/c |
| 710 |
A dir/a |
| 711 |
A dir/dir2/b2 |
| 712 |
dir/dir2/b |
| 713 |
R dir/d |
| 714 |
R dir/dir2/b |
| 715 |
$ cd .. |
| 716 |
|
| 717 |
Renames, similarity and git diff |
| 718 |
|
| 719 |
$ hg revert -aC |
| 720 |
forgetting dir/a |
| 721 |
forgetting dir/dir2/b2 |
| 722 |
reverting dir/dir2/c |
| 723 |
undeleting dir/d |
| 724 |
undeleting dir/dir2/b |
| 725 |
$ rm dir/a dir/dir2/b2 |
| 726 |
$ hg import --similarity 90 --no-commit - <<EOF |
| 727 |
> diff --git a/a b/b |
| 728 |
> rename from a |
| 729 |
> rename to b |
| 730 |
> EOF |
| 731 |
applying patch from stdin |
| 732 |
$ hg st --copies |
| 733 |
A b |
| 734 |
a |
| 735 |
R a |
| 736 |
$ cd .. |
| 737 |
|
| 738 |
Pure copy with existing destination |
| 739 |
|
| 740 |
$ hg init copytoexisting |
| 741 |
$ cd copytoexisting |
| 742 |
$ echo a > a |
| 743 |
$ echo b > b |
| 744 |
$ hg ci -Am add |
| 745 |
adding a |
| 746 |
adding b |
| 747 |
$ hg import --no-commit - <<EOF |
| 748 |
> diff --git a/a b/b |
| 749 |
> copy from a |
| 750 |
> copy to b |
| 751 |
> EOF |
| 752 |
applying patch from stdin |
| 753 |
abort: cannot create b: destination already exists |
| 754 |
[20] |
| 755 |
$ cat b |
| 756 |
b |
| 757 |
|
| 758 |
Copy and changes with existing destination |
| 759 |
|
| 760 |
$ hg import --no-commit - <<EOF |
| 761 |
> diff --git a/a b/b |
| 762 |
> copy from a |
| 763 |
> copy to b |
| 764 |
> --- a/a |
| 765 |
> +++ b/b |
| 766 |
> @@ -1,1 +1,2 @@ |
| 767 |
> a |
| 768 |
> +b |
| 769 |
> EOF |
| 770 |
applying patch from stdin |
| 771 |
cannot create b: destination already exists |
| 772 |
1 out of 1 hunks FAILED -- saving rejects to file b.rej |
| 773 |
abort: patch failed to apply |
| 774 |
[20] |
| 775 |
$ cat b |
| 776 |
b |
| 777 |
|
| 778 |
#if symlink |
| 779 |
|
| 780 |
$ ln -s b linkb |
| 781 |
$ hg add linkb |
| 782 |
$ hg ci -m addlinkb |
| 783 |
$ hg import --no-commit - <<EOF |
| 784 |
> diff --git a/linkb b/linkb |
| 785 |
> deleted file mode 120000 |
| 786 |
> --- a/linkb |
| 787 |
> +++ /dev/null |
| 788 |
> @@ -1,1 +0,0 @@ |
| 789 |
> -badhunk |
| 790 |
> \ No newline at end of file |
| 791 |
> EOF |
| 792 |
applying patch from stdin |
| 793 |
patching file linkb |
| 794 |
Hunk #1 FAILED at 0 |
| 795 |
1 out of 1 hunks FAILED -- saving rejects to file linkb.rej |
| 796 |
abort: patch failed to apply |
| 797 |
[20] |
| 798 |
$ hg st |
| 799 |
? b.rej |
| 800 |
? linkb.rej |
| 801 |
|
| 802 |
#endif |
| 803 |
|
| 804 |
Test corner case involving copies and multiple hunks (issue3384) |
| 805 |
|
| 806 |
$ hg revert -qa |
| 807 |
$ hg import --no-commit - <<EOF |
| 808 |
> diff --git a/a b/c |
| 809 |
> copy from a |
| 810 |
> copy to c |
| 811 |
> --- a/a |
| 812 |
> +++ b/c |
| 813 |
> @@ -1,1 +1,2 @@ |
| 814 |
> a |
| 815 |
> +a |
| 816 |
> @@ -2,1 +2,2 @@ |
| 817 |
> a |
| 818 |
> +a |
| 819 |
> diff --git a/a b/a |
| 820 |
> --- a/a |
| 821 |
> +++ b/a |
| 822 |
> @@ -1,1 +1,2 @@ |
| 823 |
> a |
| 824 |
> +b |
| 825 |
> EOF |
| 826 |
applying patch from stdin |
| 827 |
|
| 828 |
Test email metadata |
| 829 |
|
| 830 |
$ hg revert -qa |
| 831 |
$ hg --encoding utf-8 import - <<EOF |
| 832 |
> From: =?utf-8?q?Rapha=C3=ABl_Hertzog_=3Chertzog=40debian=2Eorg=3E?= |
| 833 |
> Subject: [PATCH] =?UTF-8?q?=C5=A7=E2=82=AC=C3=9F=E1=B9=AA?= |
| 834 |
> |
| 835 |
> diff --git a/a b/a |
| 836 |
> --- a/a |
| 837 |
> +++ b/a |
| 838 |
> @@ -1,1 +1,2 @@ |
| 839 |
> a |
| 840 |
> +a |
| 841 |
> EOF |
| 842 |
applying patch from stdin |
| 843 |
$ hg --encoding utf-8 log -r . |
| 844 |
changeset: *:* (glob) |
| 845 |
tag: tip |
| 846 |
user: Rapha\xc3\xabl Hertzog <[email protected]> (esc) |
| 847 |
date: * (glob) |
| 848 |
summary: \xc5\xa7\xe2\x82\xac\xc3\x9f\xe1\xb9\xaa (esc) |
| 849 |
|
| 850 |
|
| 851 |
$ cd .. |