Mercurial > hg
view tests/test-import-git.t @ 46149:294d5aca4ff5
copies: iterate over children directly (instead of parents)
Before this change we would gather all parent → child edges and iterate on
all parent, gathering copy information for children and aggregating them from
there.
They are not strict requirement for edges to be processed in that specific
order. We could also simply iterate over all "children" revision and aggregate
data from both parents at the same time. This patch does that.
It make various things simpler:
* since both parents are processed at the same time, we no longer need to
cache data for merge (see next changeset for details),
* we no longer need nested loop to process data,
* we no longer need to store partial merge data for a rev from distinct loop
interaction to another when processing merges,
* we no longer need to build a full parent -> children mapping (we only rely on
a simpler "parent -> number of children" map (for memory efficiency),
* the data access pattern is now simpler (from lower revisions to higher
revisions) and entirely predicable. That predictability open the way to
prefetching and parallel processing.
So that new iterations order requires simpler code and open the way to
interesting optimisation.
The effect on performance is quite good. In the worse case, we don't see any
significant negative impact. And in the best case, the reduction of roundtrip
to Python provide us with a significant speed. Some example below:
Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev
---------------------------------------------------------------------------------------------------------------------------------------------------------------
mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.962867 s, 0.502584 s, -0.460283 s, × 0.5220, 14 µs/rev
mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.110717 s, 0.076323 s, -0.034394 s, × 0.6894, 8 µs/rev
# full comparison between the previous changeset and this one
Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev
---------------------------------------------------------------------------------------------------------------------------------------------------------------
mercurial x_revs_x_added_0_copies ad6b123de1c7 39cfcef4f463 : 1 revs, 0.000048 s, 0.000041 s, -0.000007 s, × 0.8542, 41 µs/rev
mercurial x_revs_x_added_x_copies 2b1c78674230 0c1d10351869 : 6 revs, 0.000153 s, 0.000102 s, -0.000051 s, × 0.6667, 17 µs/rev
mercurial x000_revs_x000_added_x_copies 81f8ff2a9bf2 dd3267698d84 : 1032 revs, 0.004209 s, 0.004254 s, +0.000045 s, × 1.0107, 4 µs/rev
pypy x_revs_x_added_0_copies aed021ee8ae8 099ed31b181b : 9 revs, 0.000203 s, 0.000282 s, +0.000079 s, × 1.3892, 31 µs/rev
pypy x_revs_x000_added_0_copies 4aa4e1f8e19a 359343b9ac0e : 1 revs, 0.000059 s, 0.000048 s, -0.000011 s, × 0.8136, 48 µs/rev
pypy x_revs_x_added_x_copies ac52eb7bbbb0 72e022663155 : 7 revs, 0.000194 s, 0.000211 s, +0.000017 s, × 1.0876, 30 µs/rev
pypy x_revs_x00_added_x_copies c3b14617fbd7 ace7255d9a26 : 1 revs, 0.000380 s, 0.000375 s, -0.000005 s, × 0.9868, 375 µs/rev
pypy x_revs_x000_added_x000_copies df6f7a526b60 a83dc6a2d56f : 6 revs, 0.010588 s, 0.010574 s, -0.000014 s, × 0.9987, 1762 µs/rev
pypy x000_revs_xx00_added_0_copies 89a76aede314 2f22446ff07e : 4785 revs, 0.048961 s, 0.049974 s, +0.001013 s, × 1.0207, 10 µs/rev
pypy x000_revs_x000_added_x_copies 8a3b5bfd266e 2c68e87c3efe : 6780 revs, 0.083612 s, 0.084300 s, +0.000688 s, × 1.0082, 12 µs/rev
pypy x000_revs_x000_added_x000_copies 89a76aede314 7b3dda341c84 : 5441 revs, 0.058579 s, 0.060128 s, +0.001549 s, × 1.0264, 11 µs/rev
pypy x0000_revs_x_added_0_copies d1defd0dc478 c9cb1334cc78 : 43645 revs, 0.736783 s, 0.686542 s, -0.050241 s, × 0.9318, 15 µs/rev
pypy x0000_revs_xx000_added_0_copies bf2c629d0071 4ffed77c095c : 2 revs, 0.022050 s, 0.009277 s, -0.012773 s, × 0.4207, 4638 µs/rev
pypy x0000_revs_xx000_added_x000_copies 08ea3258278e d9fa043f30c0 : 11316 revs, 0.120800 s, 0.114733 s, -0.006067 s, × 0.9498, 10 µs/rev
netbeans x_revs_x_added_0_copies fb0955ffcbcd a01e9239f9e7 : 2 revs, 0.000140 s, 0.000081 s, -0.000059 s, × 0.5786, 40 µs/rev
netbeans x_revs_x000_added_0_copies 6f360122949f 20eb231cc7d0 : 2 revs, 0.000114 s, 0.000107 s, -0.000007 s, × 0.9386, 53 µs/rev
netbeans x_revs_x_added_x_copies 1ada3faf6fb6 5a39d12eecf4 : 3 revs, 0.000224 s, 0.000173 s, -0.000051 s, × 0.7723, 57 µs/rev
netbeans x_revs_x00_added_x_copies 35be93ba1e2c 9eec5e90c05f : 9 revs, 0.000723 s, 0.000698 s, -0.000025 s, × 0.9654, 77 µs/rev
netbeans x000_revs_xx00_added_0_copies eac3045b4fdd 51d4ae7f1290 : 1421 revs, 0.009665 s, 0.009248 s, -0.000417 s, × 0.9569, 6 µs/rev
netbeans x000_revs_x000_added_x_copies e2063d266acd 6081d72689dc : 1533 revs, 0.014820 s, 0.015446 s, +0.000626 s, × 1.0422, 10 µs/rev
netbeans x000_revs_x000_added_x000_copies ff453e9fee32 411350406ec2 : 5750 revs, 0.076049 s, 0.074373 s, -0.001676 s, × 0.9780, 12 µs/rev
netbeans x0000_revs_xx000_added_x000_copies 588c2d1ced70 1aad62e59ddd : 66949 revs, 0.683603 s, 0.639870 s, -0.043733 s, × 0.9360, 9 µs/rev
mozilla-central x_revs_x_added_0_copies 3697f962bb7b 7015fcdd43a2 : 2 revs, 0.000161 s, 0.000088 s, -0.000073 s, × 0.5466, 44 µs/rev
mozilla-central x_revs_x000_added_0_copies dd390860c6c9 40d0c5bed75d : 8 revs, 0.000234 s, 0.000199 s, -0.000035 s, × 0.8504, 24 µs/rev
mozilla-central x_revs_x_added_x_copies 8d198483ae3b 14207ffc2b2f : 9 revs, 0.000247 s, 0.000171 s, -0.000076 s, × 0.6923, 19 µs/rev
mozilla-central x_revs_x00_added_x_copies 98cbc58cc6bc 446a150332c3 : 7 revs, 0.000630 s, 0.000592 s, -0.000038 s, × 0.9397, 84 µs/rev
mozilla-central x_revs_x000_added_x000_copies 3c684b4b8f68 0a5e72d1b479 : 3 revs, 0.003286 s, 0.003151 s, -0.000135 s, × 0.9589, 1050 µs/rev
mozilla-central x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.062441 s, 0.061612 s, -0.000829 s, × 0.9867, 10268 µs/rev
mozilla-central x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.005423 s, 0.005381 s, -0.000042 s, × 0.9923, 3 µs/rev
mozilla-central x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.005919 s, 0.003742 s, -0.002177 s, × 0.6322, 91 µs/rev
mozilla-central x000_revs_x000_added_x000_copies 7c97034feb78 4407bd0c6330 : 7839 revs, 0.062597 s, 0.061983 s, -0.000614 s, × 0.9902, 7 µs/rev
mozilla-central x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.043551 s, 0.019861 s, -0.023690 s, × 0.4560, 32 µs/rev
mozilla-central x0000_revs_xx000_added_x000_copies f78c615a656c 96a38b690156 : 30263 revs, 0.192475 s, 0.188101 s, -0.004374 s, × 0.9773, 6 µs/rev
mozilla-central x00000_revs_x0000_added_x0000_copies 6832ae71433c 4c222a1d9a00 : 153721 revs, 1.955575 s, 1.806696 s, -0.148879 s, × 0.9239, 11 µs/rev
mozilla-central x00000_revs_x00000_added_x000_copies 76caed42cf7c 1daa622bbe42 : 204976 revs, 2.886501 s, 2.682987 s, -0.203514 s, × 0.9295, 13 µs/rev
mozilla-try x_revs_x_added_0_copies aaf6dde0deb8 9790f499805a : 2 revs, 0.001181 s, 0.000852 s, -0.000329 s, × 0.7214, 426 µs/rev
mozilla-try x_revs_x000_added_0_copies d8d0222927b4 5bb8ce8c7450 : 2 revs, 0.001189 s, 0.000859 s, -0.000330 s, × 0.7225, 429 µs/rev
mozilla-try x_revs_x_added_x_copies 092fcca11bdb 936255a0384a : 4 revs, 0.000563 s, 0.000150 s, -0.000413 s, × 0.2664, 37 µs/rev
mozilla-try x_revs_x00_added_x_copies b53d2fadbdb5 017afae788ec : 2 revs, 0.001548 s, 0.001158 s, -0.000390 s, × 0.7481, 579 µs/rev
mozilla-try x_revs_x000_added_x000_copies 20408ad61ce5 6f0ee96e21ad : 1 revs, 0.027782 s, 0.027240 s, -0.000542 s, × 0.9805, 27240 µs/rev
mozilla-try x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.062781 s, 0.062824 s, +0.000043 s, × 1.0007, 10470 µs/rev
mozilla-try x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.005778 s, 0.005463 s, -0.000315 s, × 0.9455, 3 µs/rev
mozilla-try x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.006192 s, 0.004238 s, -0.001954 s, × 0.6844, 103 µs/rev
mozilla-try x000_revs_x000_added_x000_copies 1346fd0130e4 4c65cbdabc1f : 6657 revs, 0.065391 s, 0.064113 s, -0.001278 s, × 0.9805, 9 µs/rev
mozilla-try x0000_revs_x_added_0_copies 63519bfd42ee a36a2a865d92 : 40314 revs, 0.317216 s, 0.294063 s, -0.023153 s, × 0.9270, 7 µs/rev
mozilla-try x0000_revs_x_added_x_copies 9fe69ff0762d bcabf2a78927 : 38690 revs, 0.303119 s, 0.281493 s, -0.021626 s, × 0.9287, 7 µs/rev
mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.110717 s, 0.076323 s, -0.034394 s, × 0.6894, 8 µs/rev
mozilla-try x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.045739 s, 0.020390 s, -0.025349 s, × 0.4458, 33 µs/rev
mozilla-try x0000_revs_xx000_added_x000_copies 89294cd501d9 7ccb2fc7ccb5 : 97052 revs, 3.098021 s, 3.023879 s, -0.074142 s, × 0.9761, 31 µs/rev
mozilla-try x0000_revs_x0000_added_x0000_copies e928c65095ed e951f4ad123a : 52031 revs, 0.771480 s, 0.735549 s, -0.035931 s, × 0.9534, 14 µs/rev
mozilla-try x00000_revs_x_added_0_copies 6a320851d377 1ebb79acd503 : 363753 revs, 18.813422 s, 18.568900 s, -0.244522 s, × 0.9870, 51 µs/rev
mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.962867 s, 0.502584 s, -0.460283 s, × 0.5220, 14 µs/rev
mozilla-try x00000_revs_x_added_x_copies 5173c4b6f97c 95d83ee7242d : 362229 revs, 18.684923 s, 18.356645 s, -0.328278 s, × 0.9824, 50 µs/rev
mozilla-try x00000_revs_x000_added_x_copies 9126823d0e9c ca82787bb23c : 359344 revs, 18.296305 s, 18.250393 s, -0.045912 s, × 0.9975, 50 µs/rev
mozilla-try x00000_revs_x0000_added_x0000_copies 8d3fafa80d4b eb884023b810 : 192665 revs, 3.061887 s, 2.792459 s, -0.269428 s, × 0.9120, 14 µs/rev
mozilla-try x00000_revs_x00000_added_x0000_copies 1b661134e2ca 1ae03d022d6d : 228985 revs, 103.869641 s, 107.697264 s, +3.827623 s, × 1.0369, 470 µs/rev
mozilla-try x00000_revs_x00000_added_x000_copies 9b2a99adc05e 8e29777b48e6 : 382065 revs, 64.262957 s, 63.961040 s, -0.301917 s, × 0.9953, 167 µs/rev
Differential Revision: https://phab.mercurial-scm.org/D9422
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 14 Dec 2020 11:32:24 +0100 |
parents | 8c13f7b0ace6 |
children | 6a454e7053a1 |
line wrap: on
line source
$ hg init repo $ cd repo New file: $ hg import -d "1000000 0" -mnew - <<EOF > diff --git a/new b/new > new file mode 100644 > index 0000000..7898192 > --- /dev/null > +++ b/new > @@ -0,0 +1 @@ > +a > EOF applying patch from stdin $ hg tip -q 0:ae3ee40d2079 New empty file: $ hg import -d "1000000 0" -mempty - <<EOF > diff --git a/empty b/empty > new file mode 100644 > EOF applying patch from stdin $ hg tip -q 1:ab199dc869b5 $ hg locate empty empty chmod +x: $ hg import -d "1000000 0" -msetx - <<EOF > diff --git a/new b/new > old mode 100644 > new mode 100755 > EOF applying patch from stdin #if execbit $ hg tip -q 2:3a34410f282e $ test -x new $ hg rollback -q #else $ hg tip -q 1:ab199dc869b5 #endif Copy and removing x bit: $ hg import -f -d "1000000 0" -mcopy - <<EOF > diff --git a/new b/copy > old mode 100755 > new mode 100644 > similarity index 100% > copy from new > copy to copy > diff --git a/new b/copyx > similarity index 100% > copy from new > copy to copyx > EOF applying patch from stdin $ test -f copy #if execbit $ test ! -x copy $ test -x copyx $ hg tip -q 2:21dfaae65c71 #else $ hg tip -q 2:0efdaa8e3bf3 #endif $ hg up -qCr1 $ hg rollback -q Copy (like above but independent of execbit): $ hg import -d "1000000 0" -mcopy - <<EOF > diff --git a/new b/copy > similarity index 100% > copy from new > copy to copy > diff --git a/new b/copyx > similarity index 100% > copy from new > copy to copyx > EOF applying patch from stdin $ hg tip -q 2:0efdaa8e3bf3 $ test -f copy $ cat copy a $ hg cat copy a Rename: $ hg import -d "1000000 0" -mrename - <<EOF > diff --git a/copy b/rename > similarity index 100% > rename from copy > rename to rename > EOF applying patch from stdin $ hg tip -q 3:b1f57753fad2 $ hg locate copyx empty new rename Delete: $ hg import -d "1000000 0" -mdelete - <<EOF > diff --git a/copyx b/copyx > deleted file mode 100755 > index 7898192..0000000 > --- a/copyx > +++ /dev/null > @@ -1 +0,0 @@ > -a > EOF applying patch from stdin $ hg tip -q 4:1bd1da94b9b2 $ hg locate empty new rename $ test -f copyx [1] Regular diff: $ hg import -d "1000000 0" -mregular - <<EOF > diff --git a/rename b/rename > index 7898192..72e1fe3 100644 > --- a/rename > +++ b/rename > @@ -1 +1,5 @@ > a > +a > +a > +a > +a > EOF applying patch from stdin $ hg tip -q 5:46fe99cb3035 Copy and modify: $ hg import -d "1000000 0" -mcopymod - <<EOF > diff --git a/rename b/copy2 > similarity index 80% > copy from rename > copy to copy2 > index 72e1fe3..b53c148 100644 > --- a/rename > +++ b/copy2 > @@ -1,5 +1,5 @@ > a > a > -a > +b > a > a > EOF applying patch from stdin $ hg tip -q 6:ffeb3197c12d $ hg cat copy2 a a b a a Rename and modify: $ hg import -d "1000000 0" -mrenamemod - <<EOF > diff --git a/copy2 b/rename2 > similarity index 80% > rename from copy2 > rename to rename2 > index b53c148..8f81e29 100644 > --- a/copy2 > +++ b/rename2 > @@ -1,5 +1,5 @@ > a > a > b > -a > +c > a > EOF applying patch from stdin $ hg tip -q 7:401aede9e6bb $ hg locate copy2 [1] $ hg cat rename2 a a b c a One file renamed multiple times: $ hg import -d "1000000 0" -mmultirenames - <<EOF > diff --git a/rename2 b/rename3 > rename from rename2 > rename to rename3 > diff --git a/rename2 b/rename3-2 > rename from rename2 > rename to rename3-2 > EOF applying patch from stdin $ hg tip -q 8:2ef727e684e8 $ hg log -vr. --template '{rev} {files} / {file_copies}\n' 8 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2) $ hg locate rename2 rename3 rename3-2 rename3 rename3-2 $ hg cat rename3 a a b c a $ hg cat rename3-2 a a b c a $ echo foo > foo $ hg add foo $ hg ci -m 'add foo' Binary files and regular patch hunks: $ hg import -d "1000000 0" -m binaryregular - <<EOF > diff --git a/binary b/binary > new file mode 100644 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 > GIT binary patch > literal 4 > Lc\${NkU|;|M00aO5 > > diff --git a/foo b/foo2 > rename from foo > rename to foo2 > EOF applying patch from stdin $ hg tip -q 10:27377172366e $ cat foo2 foo $ hg manifest --debug | grep binary 045c85ba38952325e126c70962cc0f9d9077bc67 644 binary Multiple binary files: $ hg import -d "1000000 0" -m multibinary - <<EOF > diff --git a/mbinary1 b/mbinary1 > new file mode 100644 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 > GIT binary patch > literal 4 > Lc\${NkU|;|M00aO5 > > diff --git a/mbinary2 b/mbinary2 > new file mode 100644 > index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490 > GIT binary patch > literal 5 > Mc\${NkU|\`?^000jF3jhEB > > EOF applying patch from stdin $ hg tip -q 11:18b73a84b4ab $ hg manifest --debug | grep mbinary 045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1 a874b471193996e7cb034bb301cac7bdaf3e3f46 644 mbinary2 Binary file and delta hunk (we build the patch using this sed hack to avoid an unquoted ^, which check-code says breaks sh on Solaris): $ sed 's/ caret /^/g;s/ dollarparen /$(/g' > quote-hack.patch <<'EOF' > diff --git a/delta b/delta > new file mode 100644 > index 0000000000000000000000000000000000000000..8c9b7831b231c2600843e303e66b521353a200b3 > GIT binary patch > literal 3749 > zcmV;W4qEYvP)<h;3K|Lk000e1NJLTq006iE002D*0ssI2kt{U(0000PbVXQnQ*UN; > zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU=M@d9MRCwC#oC!>o#}>x{(W-y~UN*tK > z%A%sxiUy2Ys)0Vm#ueArYKoYqX;GuiqZpgirM6nCVoYk?YNAz3G~z;BZ~@~&OQEe4 > zmGvS5isFJI;Pd_7J+EKxyHZeu` caret t4r2>F;h-+VK3{_{WoGv8dSpFDYDrA%3UX03pt > zOaVoi0*W#P6lDr1$`nwPDWE7*rhuYM0Y#YtiZTThWeO<D6i}2YpqR<%$s>bRRaI42 > zS3iFIxJ8Q=EnBv1Z7?pBw_bLjJb3V+tgP(Tty_2R-mR#p04x78n2n7MSOFyt4i1iv > zjxH`PPEJmgD7U?IK&h;(EGQ@_DJc<@01=4fiNXHcKZ8LhZQ8T}E3U4tUS3}OrcgQW > zWdX{K8#l7Ev&#$ysR)G#0*rC+<WGZ3?CtG4bm-ve>Dj$|_qJ`@D*stNP_AFUe&x!Q > zJ9q9B7Z=ym)MyZ?Tg1ROunUYr81nV?B@!tYS~5_|%gfW#(_s<4UN1!Q?Dv8d>g#m6 > z%*@R2@bI2JdnzxQ!EDU`$eQY!tgI~Zn$prz;gaXNod5*5p(1Bz=P$qfvZ$y?dC@X~ > zlAD+NAKhB{=;6bMwzjqn>9mavvKOGd`s%A+fBiL>Q;xJWpa72C+}u{JTHUX>{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D9W11{w=@&xgJ}t2x;ep > P00000NkvXXu0mjfZ5|Er > > literal 0 > HcmV?d00001 > > EOF $ hg import -d "1000000 0" -m delta quote-hack.patch applying quote-hack.patch $ rm quote-hack.patch $ hg manifest --debug | grep delta 9600f98bb60ce732634d126aaa4ac1ec959c573e 644 delta $ hg import -d "1000000 0" -m delta - <<'EOF' > diff --git a/delta b/delta > index 8c9b7831b231c2600843e303e66b521353a200b3..0021dd95bc0dba53c39ce81377126d43731d68df 100644 > GIT binary patch > delta 49 > zcmZ1~yHs|=21Z8J$r~9bFdA-lVv=EEw4WT$qRf2QSa5SIOAHI6(&k4T8H|kLo4vWB > FSO9ZT4bA`n > > delta 49 > zcmV-10M7rV9i<(xumJ(}ld%Di0Xefm0vrMXpOaq%BLm9I%d>?9Tm%6Vv*HM70RcC& > HOA1;9yU-AD > > EOF applying patch from stdin $ hg manifest --debug | grep delta 56094bbea136dcf8dbd4088f6af469bde1a98b75 644 delta Filenames with spaces: $ sed 's,EOL$,,g' <<EOF | hg import -d "1000000 0" -m spaces - > diff --git a/foo bar b/foo bar > new file mode 100644 > index 0000000..257cc56 > --- /dev/null > +++ b/foo bar EOL > @@ -0,0 +1 @@ > +foo > EOF applying patch from stdin $ hg tip -q 14:4b79479c9a6d $ cat "foo bar" foo Copy then modify the original file: $ hg import -d "1000000 0" -m copy-mod-orig - <<EOF > diff --git a/foo2 b/foo2 > index 257cc56..fe08ec6 100644 > --- a/foo2 > +++ b/foo2 > @@ -1 +1,2 @@ > foo > +new line > diff --git a/foo2 b/foo3 > similarity index 100% > copy from foo2 > copy to foo3 > EOF applying patch from stdin $ hg tip -q 15:9cbe44af4ae9 $ cat foo3 foo Move text file and patch as binary $ echo a > text2 $ hg ci -Am0 adding text2 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" > diff --git a/text2 b/binary2 > rename from text2 > rename to binary2 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 > GIT binary patch > literal 5 > Mc$`b*O5$Pw00T?_*Z=?k > > EOF applying patch from stdin $ cat binary2 a b \x00 (no-eol) (esc) $ hg st --copies --change . A binary2 text2 R text2 Invalid base85 content $ hg rollback repository tip rolled back to revision 16 (undo import) working directory now based on revision 16 $ hg revert -aq $ hg import -d "1000000 0" -m invalid-binary - <<"EOF" > diff --git a/text2 b/binary2 > rename from text2 > rename to binary2 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 > GIT binary patch > literal 5 > Mc$`b*O.$Pw00T?_*Z=?k > > EOF applying patch from stdin abort: could not decode "binary2" binary patch: bad base85 character at position 6 [255] $ hg revert -aq $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" > diff --git a/text2 b/binary2 > rename from text2 > rename to binary2 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 > GIT binary patch > literal 6 > Mc$`b*O5$Pw00T?_*Z=?k > > EOF applying patch from stdin abort: "binary2" length is 5 bytes, should be 6 [255] $ hg revert -aq $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF" > diff --git a/text2 b/binary2 > rename from text2 > rename to binary2 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 > GIT binary patch > Mc$`b*O5$Pw00T?_*Z=?k > > EOF applying patch from stdin abort: could not extract "binary2" binary data [255] Simulate a copy/paste turning LF into CRLF (issue2870) $ hg revert -aq $ cat > binary.diff <<"EOF" > diff --git a/text2 b/binary2 > rename from text2 > rename to binary2 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 > GIT binary patch > literal 5 > Mc$`b*O5$Pw00T?_*Z=?k > > EOF >>> fp = open('binary.diff', 'rb') >>> data = fp.read() >>> fp.close() >>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n')) and None $ rm binary2 $ hg import --no-commit binary.diff applying binary.diff $ cd .. Consecutive import with renames (issue2459) $ hg init issue2459 $ cd issue2459 $ hg import --no-commit --force - <<EOF > diff --git a/a b/a > new file mode 100644 > EOF applying patch from stdin $ hg import --no-commit --force - <<EOF > diff --git a/a b/b > rename from a > rename to b > EOF applying patch from stdin a has not been committed yet, so no copy data will be stored for b. $ hg debugstate a 0 -1 unset b $ hg ci -m done $ cd .. Renames and strip $ hg init renameandstrip $ cd renameandstrip $ echo a > a $ hg ci -Am adda adding a $ hg import --no-commit -p2 - <<EOF > diff --git a/foo/a b/foo/b > rename from foo/a > rename to foo/b > EOF applying patch from stdin $ hg st --copies A b a R a Prefix with strip, renames, creates etc $ hg revert -aC forgetting b undeleting a $ rm b $ mkdir -p dir/dir2 $ echo b > dir/dir2/b $ echo c > dir/dir2/c $ echo d > dir/d $ hg ci -Am addbcd adding dir/d adding dir/dir2/b adding dir/dir2/c prefix '.' is the same as no prefix $ hg import --no-commit --prefix . - <<EOF > diff --git a/dir/a b/dir/a > --- /dev/null > +++ b/dir/a > @@ -0,0 +1 @@ > +aaaa > diff --git a/dir/d b/dir/d > --- a/dir/d > +++ b/dir/d > @@ -1,1 +1,2 @@ > d > +dddd > EOF applying patch from stdin $ cat dir/a aaaa $ cat dir/d d dddd $ hg revert -aC forgetting dir/a reverting dir/d $ rm dir/a prefix with default strip $ hg import --no-commit --prefix dir/ - <<EOF > diff --git a/a b/a > --- /dev/null > +++ b/a > @@ -0,0 +1 @@ > +aaa > diff --git a/d b/d > --- a/d > +++ b/d > @@ -1,1 +1,2 @@ > d > +dd > EOF applying patch from stdin $ cat dir/a aaa $ cat dir/d d dd $ hg revert -aC forgetting dir/a reverting dir/d $ rm dir/a (test that prefixes are relative to the cwd) $ mkdir tmpdir $ cd tmpdir $ hg import --no-commit -p2 --prefix ../dir/ - <<EOF > diff --git a/foo/a b/foo/a > new file mode 100644 > --- /dev/null > +++ b/foo/a > @@ -0,0 +1 @@ > +a > diff --git a/foo/dir2/b b/foo/dir2/b2 > rename from foo/dir2/b > rename to foo/dir2/b2 > diff --git a/foo/dir2/c b/foo/dir2/c > --- a/foo/dir2/c > +++ b/foo/dir2/c > @@ -0,0 +1 @@ > +cc > diff --git a/foo/d b/foo/d > deleted file mode 100644 > --- a/foo/d > +++ /dev/null > @@ -1,1 +0,0 @@ > -d > EOF applying patch from stdin $ hg st --copies M dir/dir2/c A dir/a A dir/dir2/b2 dir/dir2/b R dir/d R dir/dir2/b $ cd .. Renames, similarity and git diff $ hg revert -aC forgetting dir/a forgetting dir/dir2/b2 reverting dir/dir2/c undeleting dir/d undeleting dir/dir2/b $ rm dir/a dir/dir2/b2 $ hg import --similarity 90 --no-commit - <<EOF > diff --git a/a b/b > rename from a > rename to b > EOF applying patch from stdin $ hg st --copies A b a R a $ cd .. Pure copy with existing destination $ hg init copytoexisting $ cd copytoexisting $ echo a > a $ echo b > b $ hg ci -Am add adding a adding b $ hg import --no-commit - <<EOF > diff --git a/a b/b > copy from a > copy to b > EOF applying patch from stdin abort: cannot create b: destination already exists [255] $ cat b b Copy and changes with existing destination $ hg import --no-commit - <<EOF > diff --git a/a b/b > copy from a > copy to b > --- a/a > +++ b/b > @@ -1,1 +1,2 @@ > a > +b > EOF applying patch from stdin cannot create b: destination already exists 1 out of 1 hunks FAILED -- saving rejects to file b.rej abort: patch failed to apply [255] $ cat b b #if symlink $ ln -s b linkb $ hg add linkb $ hg ci -m addlinkb $ hg import --no-commit - <<EOF > diff --git a/linkb b/linkb > deleted file mode 120000 > --- a/linkb > +++ /dev/null > @@ -1,1 +0,0 @@ > -badhunk > \ No newline at end of file > EOF applying patch from stdin patching file linkb Hunk #1 FAILED at 0 1 out of 1 hunks FAILED -- saving rejects to file linkb.rej abort: patch failed to apply [255] $ hg st ? b.rej ? linkb.rej #endif Test corner case involving copies and multiple hunks (issue3384) $ hg revert -qa $ hg import --no-commit - <<EOF > diff --git a/a b/c > copy from a > copy to c > --- a/a > +++ b/c > @@ -1,1 +1,2 @@ > a > +a > @@ -2,1 +2,2 @@ > a > +a > diff --git a/a b/a > --- a/a > +++ b/a > @@ -1,1 +1,2 @@ > a > +b > EOF applying patch from stdin Test email metadata $ hg revert -qa $ hg --encoding utf-8 import - <<EOF > From: =?utf-8?q?Rapha=C3=ABl_Hertzog_=3Chertzog=40debian=2Eorg=3E?= > Subject: [PATCH] =?UTF-8?q?=C5=A7=E2=82=AC=C3=9F=E1=B9=AA?= > > diff --git a/a b/a > --- a/a > +++ b/a > @@ -1,1 +1,2 @@ > a > +a > EOF applying patch from stdin $ hg --encoding utf-8 log -r . changeset: *:* (glob) tag: tip user: Rapha\xc3\xabl Hertzog <hertzog@debian.org> (esc) date: * (glob) summary: \xc5\xa7\xe2\x82\xac\xc3\x9f\xe1\xb9\xaa (esc) $ cd ..