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".
$ hg init
$ echo a > a
$ hg ci -qAm 'add a'
$ hg init subrepo
$ echo 'subrepo = http://example.net/libfoo' > .hgsub
$ hg ci -qAm 'added subrepo'
$ hg up -qC 0
$ echo ax > a
$ hg ci -m 'changed a'
created new head
$ hg up -qC 1
$ cd subrepo
$ echo b > b
$ hg add b
$ cd ..
Should fail, since there are added files to subrepo:
$ hg merge
abort: outstanding uncommitted changes in subrepository 'subrepo'
[255]