Mercurial > hg
view tests/test-import-unknown.t @ 25115:5548f558db3d
revset: fix iteration over ordered addset composed of non-ordered operands
Before this change, doing ordered iteration over an 'addset' object composed of
operands without fastasc or fastdesc method could result in duplicated entries.
This was the result of applying '_iterordered' on an unordered set.
We fix it by ensuring we iterate over the set in a sorted order. Using the fast
iterator when it exists on any operand. We kill the '_iterator' method in the
process because it did not make a lot of sense independently.
Thanks goes to Yuya Nishihara for reporting the issue and analysing the cause.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 15 May 2015 00:25:43 -0700 |
parents | f2719b387380 |
children | 6a454e7053a1 |
line wrap: on
line source
$ cat <<EOF >> $HGRCPATH > [extensions] > purge = > EOF $ hg init test $ cd test $ echo a > changed $ echo a > removed $ echo a > source $ hg ci -Am addfiles adding changed adding removed adding source $ echo a >> changed $ echo a > added $ hg add added $ hg rm removed $ hg cp source copied $ hg diff --git > ../unknown.diff Test adding on top of an unknown file $ hg up -qC 0 $ hg purge $ echo a > added $ hg import --no-commit ../unknown.diff applying ../unknown.diff file added already exists 1 out of 1 hunks FAILED -- saving rejects to file added.rej abort: patch failed to apply [255] Test modifying an unknown file $ hg revert -aq $ hg purge $ hg rm changed $ hg ci -m removechanged $ echo a > changed $ hg import --no-commit ../unknown.diff applying ../unknown.diff abort: cannot patch changed: file is not tracked [255] Test removing an unknown file $ hg up -qC 0 $ hg purge $ hg rm removed $ hg ci -m removeremoved created new head $ echo a > removed $ hg import --no-commit ../unknown.diff applying ../unknown.diff abort: cannot patch removed: file is not tracked [255] Test copying onto an unknown file $ hg up -qC 0 $ hg purge $ echo a > copied $ hg import --no-commit ../unknown.diff applying ../unknown.diff abort: cannot create copied: destination already exists [255] $ cd ..