[PATCH 4 of 4] log: add TODO comments about --line-range processing

Denis Laxalde denis at laxalde.org
Mon Feb 12 15:32:15 EST 2018


Yuya Nishihara a écrit :
> On Mon, 12 Feb 2018 13:42:54 +0100, Denis Laxalde wrote:
>> Yuya Nishihara a écrit :
>>> On Mon, 12 Feb 2018 12:04:21 +0100, Denis Laxalde wrote:
>>>> Yuya Nishihara a écrit :
>>>>> This is totally unrelated topic, but how would we do if we want to support
>>>>> non-contiguous range?
>>>>>
>>>>>    -L file,a:b,c:d
>>>>>
>>>>> is ambiguous because file may contain ",".
>>>>
>>>> I guess we could iteratively rsplit(",", 1) the file pattern and try to
>>>> parse "from:to" until it fails, meaning that the remaining would be the
>>>> file name. Slightly more complicated than it is now, but still doable I
>>>> think.
>>>
>>> That doesn't sound nice because only reason we've introduced -L was to reliably
>>> split linerange from file pattern. "1:2" looks odd, but is a valid filename on
>>> non-Windows.
>>
>> I'm afraid I don't follow, could you elaborate a bit?
>>
>> By the way, I worked on this a bit earlier, just after your first email
>> today:
>>
>>    https://hg.logilab.org/users/dlaxalde/hg/rev/6d8c75041b21
>>
>> It seems to be working, but I may have missed something of course.
> 
> I meant "1:2,3:4,5:6" could be parsed as either
> 
>   file="1:2,3:4" linerange="5:6"
> 
> or
> 
>   file="1:2" linerange="3:4,5:6"
> 
> because "1:2,3:4" is a valid filename. This would get more complicated if
> we want to support other types of linerange specifier seen in git.

Ok, I see. Any separation character (apart from / maybe) would lead to 
such ambiguities I guess. Maybe we can live without this and specify -L 
multiple times? I have no better idea at the moment.


More information about the Mercurial-devel mailing list