[PATCH STABLE] transplant: handle non-empty patches doing nothing (issue2806)

Patrick Mézard patrick at mezard.eu
Wed Aug 1 10:52:38 CDT 2012


On 7/31/12, Patrick Mezard <patrick at mezard.eu> wrote:
> # HG changeset patch
> # User Patrick Mezard <patrick at mezard.eu>
> # Date 1343749172 -7200
> # Branch stable
> # Node ID 3fc1bd37e77731208359259575ac6ed06726189b
> # Parent  7d2967de2c04489f9ce64308eb39d8a55d66af7c
> 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".

Actually it can still drop changes on the floor, when changing file
modes on Windows for instance. Note that hg import also silently
discards such changes. Not sure what to do at this point, maybe try
reimplementing with patchrepo + update.

--
Patrick Mézard


More information about the Mercurial-devel mailing list