Re: Rejected patch hunk resolving
From: Hans-Emil Skogh <Hans-Emil.Skogh_at_tritech.se>
Date: Wed, 26 Oct 2011 07:16:19 +0000
>> I have been doing some patch applying as of late, and some of them on
But the patch algorithm here is being conservative. It expects to find a matching "clean" place to apply the hunk. If we would give the result to a human operator for manual resolving, we could be much more aggressive. That is: Make a best guess where to apply the patch.
Maybe I'm just repeatedly hitting an edge case here, but almost invariably when I was applying the patches here the context lines of the hunks were still present in the code, maybe not on the expected row number, but pretty close. In that case we could simply replace whatever that is present between the context start and end lines in the source with what would have been the result of the patch file. In the process, more or less blindly, throwing away a bunch of lines; which would be OK since the user will be presented with this "conflict" in a nice (and familiar) manner.
> Since we don't have the original file we also can't just apply them
That was another, much simpler, suggestion that I was about to make, but refrained from since it doesn't (really*) work with "dirty" WC:s.
I guess it would make sense to automate this. It could be an option (or part of a new, more user friendly patch dialog (as suggested (much) earlier), ) when applying a patch to do the above mentioned steps automatically.
* Ok, it works on WC:s with changes as well, but sometimes the changes on the WC will have a hard time surviving going back in time. (The changes may have been on lines that did not exist when the patch was created.) To solve this using the above mentioned method one would have to create a patch with the changes in the WC, then do the time-traveling-patch applying, then apply the patch that was created before. Of course this patch will fail to apply cleanly leaving the user (me :-) ) in a kind of catch 22. Ah well, the final solution (today) is not all that bad; looking at the failed hunks and doing the edits all manually. But there seems to be room for improvements here...
Hmm... The more I think about it, the more I think that an overall overhaul of the apply patch command GUI would probably be more worthwhile as a first step. Perhaps including the automation of the time-traveling-patch-application.
Hans-Emil
------------------------------------------------------
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
|
This is an archived mail posted to the TortoiseSVN Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.