comparison tests/test-transplant.t @ 17319:a189d4470a34 stable

transplant: handle non-empty patches doing nothing (issue2806) If patch.patch() reports patched files when applying a changeset and the following commit says nothing changed, transplant used to abort with a RuntimeError, assuming something went wrong with patching. The mismatch is patch.patch() reports patched files, not changed ones. It could be modified to report changed files but it means duplicating work from status, may be expensive in the case of binary files, and is probably not that useful at API level. For instance, if two patches are applied on the working directory, the outcome may be nothing changed while each call would have returned modified files. The caller would have to call status() itself again. This patch fixes the issue by trusting patching code: if the patch succeeded and commit reports nothing changed, then nothing changed, patch() did not "dropped changes on the floor".
author Patrick Mezard <patrick@mezard.eu>
date Tue, 31 Jul 2012 17:39:32 +0200
parents a3da6f298592
children 0c3c65c0d3fc
comparison
equal deleted inserted replaced
17318:7ac5800dbc8f 17319:a189d4470a34
601 $ cd merge2b 601 $ cd merge2b
602 $ hg transplant -s ../merge2a --parent 0 tip 602 $ hg transplant -s ../merge2a --parent 0 tip
603 applying be9f9b39483f 603 applying be9f9b39483f
604 be9f9b39483f transplanted to 9959e51f94d1 604 be9f9b39483f transplanted to 9959e51f94d1
605 $ cd .. 605 $ cd ..
606
607 test transplanting a patch turning into a no-op
608
609 $ hg init binarysource
610 $ cd binarysource
611 $ echo a > a
612 $ hg ci -Am adda a
613 >>> file('b', 'wb').write('\0b1')
614 $ hg ci -Am addb b
615 >>> file('b', 'wb').write('\0b2')
616 $ hg ci -m changeb b
617 $ cd ..
618
619 $ hg clone -r0 binarysource binarydest
620 adding changesets
621 adding manifests
622 adding file changes
623 added 1 changesets with 1 changes to 1 files
624 updating to branch default
625 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
626 $ cd binarydest
627 $ cp ../binarysource/b b
628 $ hg ci -Am addb2 b
629 $ hg transplant -s ../binarysource 2
630 searching for changes
631 applying 7a7d57e15850
632 7a7d57e158501e51588f5fd3288b491cac77e0d8: empty changeset (no-eol)
633 $ cd ..
634