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

Yuya Nishihara yuya at tcha.org
Fri Oct 13 10:24:13 EDT 2017


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


More information about the Mercurial-devel mailing list