Mercurial > hg
view tests/test-import-git.t @ 30155:b7a966ce89ed
changelog: disable delta chains
This patch disables delta chains on changelogs. After this patch, new
entries on changelogs - including existing changelogs - will be stored
as the fulltext of that data (likely compressed). No delta computation
will be performed.
An overview of delta chains and data justifying this change follows.
Revlogs try to store entries as a delta against a previous entry (either
a parent revision in the case of generaldelta or the previous physical
revision when not using generaldelta). Most of the time this is the
correct thing to do: it frequently results in less CPU usage and smaller
storage.
Delta chains are most effective when the base revision being deltad
against is similar to the current data. This tends to occur naturally
for manifests and file data, since only small parts of each tend to
change with each revision. Changelogs, however, are a different story.
Changelog entries represent changesets/commits. And unless commits in a
repository are homogonous (same author, changing same files, similar
commit messages, etc), a delta from one entry to the next tends to be
relatively large compared to the size of the entry. This means that
delta chains tend to be short. How short? Here is the full vs delta
revision breakdown on some real world repos:
Repo % Full % Delta Max Length
hg 45.8 54.2 6
mozilla-central 42.4 57.6 8
mozilla-unified 42.5 57.5 17
pypy 46.1 53.9 6
python-zstandard 46.1 53.9 3
(I threw in python-zstandard as an example of a repo that is homogonous.
It contains a small Python project with changes all from the same
author.)
Contrast this with the manifest revlog for these repos, where 99+% of
revisions are deltas and delta chains run into the thousands.
So delta chains aren't as useful on changelogs. But even a short delta
chain may provide benefits. Let's measure that.
Delta chains may require less CPU to read revisions if the CPU time
spent reading smaller deltas is less than the CPU time used to
decompress larger individual entries. We can measure this via
`hg perfrevlog -c -d 1` to iterate a revlog to resolve each revision's
fulltext. Here are the results of that command on a repo using delta
chains in its changelog and on a repo without delta chains:
hg (forward)
! wall 0.407008 comb 0.410000 user 0.410000 sys 0.000000 (best of 25)
! wall 0.390061 comb 0.390000 user 0.390000 sys 0.000000 (best of 26)
hg (reverse)
! wall 0.515221 comb 0.520000 user 0.520000 sys 0.000000 (best of 19)
! wall 0.400018 comb 0.400000 user 0.390000 sys 0.010000 (best of 25)
mozilla-central (forward)
! wall 4.508296 comb 4.490000 user 4.490000 sys 0.000000 (best of 3)
! wall 4.370222 comb 4.370000 user 4.350000 sys 0.020000 (best of 3)
mozilla-central (reverse)
! wall 5.758995 comb 5.760000 user 5.720000 sys 0.040000 (best of 3)
! wall 4.346503 comb 4.340000 user 4.320000 sys 0.020000 (best of 3)
mozilla-unified (forward)
! wall 4.957088 comb 4.950000 user 4.940000 sys 0.010000 (best of 3)
! wall 4.660528 comb 4.650000 user 4.630000 sys 0.020000 (best of 3)
mozilla-unified (reverse)
! wall 6.119827 comb 6.110000 user 6.090000 sys 0.020000 (best of 3)
! wall 4.675136 comb 4.670000 user 4.670000 sys 0.000000 (best of 3)
pypy (forward)
! wall 1.231122 comb 1.240000 user 1.230000 sys 0.010000 (best of 8)
! wall 1.164896 comb 1.160000 user 1.160000 sys 0.000000 (best of 9)
pypy (reverse)
! wall 1.467049 comb 1.460000 user 1.460000 sys 0.000000 (best of 7)
! wall 1.160200 comb 1.170000 user 1.160000 sys 0.010000 (best of 9)
The data clearly shows that it takes less wall and CPU time to resolve
revisions when there are no delta chains in the changelogs, regardless
of the direction of traversal. Furthermore, not using a delta chain
means that fulltext resolution in reverse is as fast as iterating
forward. So not using delta chains on the changelog is a clear CPU win
for reading operations.
An example of a user-visible operation showing this speed-up is revset
evaluation. Here are results for
`hg perfrevset 'author(gps) or author(mpm)'`:
hg
! wall 1.655506 comb 1.660000 user 1.650000 sys 0.010000 (best of 6)
! wall 1.612723 comb 1.610000 user 1.600000 sys 0.010000 (best of 7)
mozilla-central
! wall 17.629826 comb 17.640000 user 17.600000 sys 0.040000 (best of 3)
! wall 17.311033 comb 17.300000 user 17.260000 sys 0.040000 (best of 3)
What about 00changelog.i size?
Repo Delta Chains No Delta Chains
hg 7,033,250 6,976,771
mozilla-central 82,978,748 81,574,623
mozilla-unified 88,112,349 86,702,162
pypy 20,740,699 20,659,741
The data shows that removing delta chains from the changelog makes the
changelog smaller.
Delta chains are also used during changegroup generation. This
operation essentially converts a series of revisions to one large
delta chain. And changegroup generation is smart: if the delta in
the revlog matches what the changegroup is emitting, it will reuse
the delta instead of recalculating it. We can measure the impact
removing changelog delta chains has on changegroup generation via
`hg perfchangegroupchangelog`:
hg
! wall 1.589245 comb 1.590000 user 1.590000 sys 0.000000 (best of 7)
! wall 1.788060 comb 1.790000 user 1.790000 sys 0.000000 (best of 6)
mozilla-central
! wall 17.382585 comb 17.380000 user 17.340000 sys 0.040000 (best of 3)
! wall 20.161357 comb 20.160000 user 20.120000 sys 0.040000 (best of 3)
mozilla-unified
! wall 18.722839 comb 18.720000 user 18.680000 sys 0.040000 (best of 3)
! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3)
pypy
! wall 4.828317 comb 4.830000 user 4.820000 sys 0.010000 (best of 3)
! wall 5.415455 comb 5.420000 user 5.410000 sys 0.010000 (best of 3)
The data shows eliminating delta chains makes the changelog part of
changegroup generation slower. This is expected since we now have to
compute deltas for revisions where we could recycle the delta before.
It is worth putting this regression into context of overall changegroup
times. Here is the rough total CPU time spent in changegroup generation
for various repos while using delta chains on the changelog:
Repo CPU Time (s) CPU Time w/ compression
hg 4.50 7.05
mozilla-central 111.1 222.0
pypy 28.68 75.5
Before compression, removing delta chains from the changegroup adds
~4.4% overhead to hg changegroup generation, 1.3% to mozilla-central,
and 2.0% to pypy. When you factor in zlib compression, these percentages
are roughly divided by 2.
While the increased CPU usage for changegroup generation is unfortunate,
I think it is acceptable because the percentage is small, server
operators (those likely impacted most by this) have other mechanisms
to mitigate CPU consumption (namely reducing zlib compression level and
pre-generated clone bundles), and because there is room to optimize this
in the future. For example, we could use the nullid as the base revision,
effectively encoding the full revision for each entry in the changegroup.
When doing this, `hg perfchangegroupchangelog` nearly halves:
mozilla-unified
! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3)
! wall 11.196461 comb 11.200000 user 11.190000 sys 0.010000 (best of 3)
This looks very promising as a future optimization opportunity.
It's worth that the changes in test-acl.t to the changegroup part size.
This is because revision 6 in the changegroup had a delta chain of
length 2 before and after this patch the base revision is nullrev.
When the base revision is nullrev, cg2packer.deltaparent() hardcodes
the *previous* revision from the changegroup as the delta parent.
This caused the delta in the changegroup to switch base revisions,
the delta to change, and the size to change accordingly. While the
size increased in this case, I think sizes will remain the same
on average, as the delta base for changelog revisions doesn't matter
too much (as this patch shows). So, I don't consider this a regression.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 12:50:27 +0200 |
parents | c64926b365b6 |
children | 4441705b7111 |
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;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OiMc;u3OQ > z@Bs)w3=lzfKoufH$SFuPG@uZ4NOnM#+=8LnQ2Q4zUd+nM+OT26;lqbN{P07dhH{jH > zManE8 caret dLms-Q2;1kB<*Q1a3f8kZr;xX=!Qro@`~@xN*Qj>gx;i;0Z24!~i2uLb`}v > zA?R$|wvC+m caret Ups=*(4lDh*=UN8{5h(A?p#D caret 2N$8u4Z55!q?ZAh(iEEng9_Zi>IgO > z#~**JC8hE4@n{hO&8btT5F*?nC_%LhA3i)PDhh-pB_&1wGrDIl caret *=8x3n&;akBf caret - > zJd&86kq$%%907v caret tgWoQdwI`|oNK%VvU~S#C<o caret F?6c48?Cjj#-4P<>HFD%&|Ni~t > zKJ(|#H`$<5W+6ZkBb213rXonKZLB+X> caret L}J@W6osP3piLD_5?R!`S}*{xLBzFiL4@ > zX+}l{`A%?f@T5tT%ztu60p;)be`fWC`tP@WpO=?cpf8Xuf1OSj6d3f@Ki(ovDYq%0 > z{4ZSe`kOay5@=lAT!}vFzxyemC{sXDrhuYM0Y#ZI1r%ipD9W11{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 = file('binary.diff', 'rb') >>> data = fp.read() >>> fp.close() >>> file('binary.diff', 'wb').write(data.replace('\n', '\r\n')) $ 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 undeleting a forgetting b $ 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 (glob) reverting dir/d (glob) $ 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 (glob) reverting dir/d (glob) $ 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 (glob) undeleting dir/d (glob) undeleting dir/dir2/b (glob) forgetting dir/dir2/b2 (glob) reverting dir/dir2/c (glob) $ 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=20Hertzog?= <hertzog@debian.org> > 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 ..