[PATCH 4 of 7] patch: drop internalpatch checks for NoHunks

Augie Fackler durin42 at gmail.com
Wed Apr 28 07:41:10 CDT 2010


On Apr 28, 2010, at 7:39 AM, Mads Kiilerich wrote:

> Benoit Boissinot wrote, On 04/28/2010 02:16 PM:
>> On Wed, Apr 28, 2010 at 12:51 PM, Mads  
>> Kiilerich<mads at kiilerich.com>  wrote:
>>
>>> In my opinion we don't have to recognize all malformed patches as  
>>> long as we
>>> handle the well-formed patches correct and don't behave too badly on
>>> malformed patches.
>>>
>>> The "internal patcher failed" message and fallback to external  
>>> patcher seems
>>> very odd.
>>>
>>> ...
>>>
>>> Admitted: There is no strong evidence here.
>>>
>>> Could someone please explain in test or code comments why NoHunks  
>>> and the
>>> state variables are needed and for which cases - and thus prove  
>>> that this is
>>> a bad idea?
>>>
>>>
>> The idea is that if someone tries to patch something and we don't
>> detect any changes, then it *must* be a bug.
>>
>
> Bug? Applying an empty patch is so stupid that it probably is a user  
> error, but why should Mercurial have special handling of that?  
> Leaving the working directory and dirstate unmodified seems like the  
> obvious and well-defined behavior in that case.

It seems only reasonable to tell the user "we didn't import anything"  
since they asked us to (in fact, they likely asked us to make a new  
commit from the diff, which is certainly an error if the diff was  
empty.)

>
> By the way, one specific problem: It seems like gitworkdone isn't  
> initialized properly for new files?
>
> /Mads



More information about the Mercurial-devel mailing list