[PATCH 4 of 4 v3] log: add -L/--line-range option to follow file history by line range

Augie Fackler raf at durin42.com
Sat Oct 14 01:17:26 EDT 2017


(+jordigh, themystic, indygreg in case one of them has an opinion or inspiration)

> On Oct 13, 2017, at 10:24 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> On Fri, 13 Oct 2017 10:02:07 +0200, Denis Laxalde wrote:
>> Yuya Nishihara a écrit :
>>> On Tue, 10 Oct 2017 17:37:27 +0200, Denis Laxalde wrote:
>>>> # HG changeset patch
>>>> # User Denis Laxalde <denis.laxalde at logilab.fr>
>>>> # Date 1507290475 -7200
>>>> #      Fri Oct 06 13:47:55 2017 +0200
>>>> # Node ID a05d3b45319a9ec28205f19dd7012b206a2b200f
>>>> # Parent  86a055d1c06f55daeb5d725187b61522974d24e3
>>>> # Available At http://hg.logilab.org/users/dlaxalde/hg
>>>> #              hg pull http://hg.logilab.org/users/dlaxalde/hg -r a05d3b45319a
>>>> # EXP-Topic followlines-cli/v2
>>>> log: add -L/--line-range option to follow file history by line range
>>> 
>>> The series generally looks good to me in functionality POV. Some nits follow.
>> 
>> Nits addressed in v4 which I can send now or once we agree on the UI.
>> 
>>> 
>>> So, do we really like this UI?
>> 
>> For the record, there are currently two proposals:
>> 
>> 1. The one implemented in this patch that adds a -L option to specify
>>    both the file and its line range:
>> 
>>      hg log -L file.c,13-23 -L main.c,2-6
>> 
>> 2. The idea by Yuya to have pairs of -L FROMLINE-TOLINE options and
>>    regular FILE arguments
>> 
>>      hg log -L 13-23 file.c -L 2-6 main.c
>> 
>>    The issue with this one (as explained in [1]) is that option parsing
>>    would not be strict, meaning that (IIUC) we would allow:
>> 
>>      hg log -L 13-23 -L 2-6 file.c main.c
>> 
>>    to work the same as the previous example.
> 
> Thanks for the great summary. Some other crazy proposals just came up:
> 
> 3. Extend the fileset syntax
> 
>      hg log set:file.c at 13-23 set:main.c at 2-6
> 
>    but we have to always type 'set:'
> 
> 4. Reuse the matcher kind to carry linerange in pats
> 
>      hg log file.c L:13-23 main.c L:2-6
> 
>    linerange: and L: are preprocessed to be paired with the previous file
>    pattern.
> 
> Another UI concern is whether --follow should be implied or required:
> 
>  hg log -L file.c,13-23  (implies --follow)
> 
> or
> 
>  hg log -L file.c,13-23  (abort)
>  hg log --follow -L file.c,13-23
> 
> If we take the latter, a plain file pattern can be used to select all lines.
> 
>  hg log --follow -L file.c,13-23 main.c

I feel like the -L file.c,13-23 is the least ambiguous option in terms of understanding what a command *does*, and probably also the easiest to actually implement with our command line parser. The others feel clever in a way that kind of makes me nervous.

I guess that’s to say, +0 on that version, and I think my second choice is the fileset syntax option? None of these enthuse me, but I’d be enthusiastic about landing the feature *somehow*. I’m hesitant to not ship this series with 4.4, as it seems like this is just complicated enough we’ll have to do something that’s a compromise no matter what to make it work on the command line.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20171014/f76023a3/attachment.sig>


More information about the Mercurial-devel mailing list