history at diff blocks level

Yuya Nishihara yuya at tcha.org
Thu Oct 20 12:00:35 EDT 2016


On Wed, 19 Oct 2016 17:41:58 +0100, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2016-10-18 23:38:19 +0900:
> > On Tue, 18 Oct 2016 08:59:58 +0200, Denis Laxalde wrote:
> > > Jun Wu a écrit :
> > > > Excerpts from Denis Laxalde's message of 2016-10-03 16:38:17 +0200:
> > > >>  From UI point of view, the basic idea is to specify a (file name, line
> > > >> range) pair and the simplest solution I could find is something like:
> > > >>
> > > >>    hg log/annotate --line-range fromline,toline FILE
> > > >>
> > > >> but this does not work well with several files. (Perhaps something like
> > > >> hg log FILE:fromline:toline would be better.) I also thought about a
> > > >
> > > > +1 for "FILE:fromline:toline". It is intuitive and makes sense. A new
> > > > boolean flag (like "--line-ranges") that enables the syntax explicitly
> > > > may be necessary. The flag can avoid conflicts with existing matcher syntax,
> > > > and make it clear that some commands like "add" do not support line ranges.
> > > 
> > > "FILE:fromline:toline" is also my favorite option. But I'm not sure I'd
> > > like to be forced to specify an extra option to be able to use this
> > > syntax. I'd much prefer if this could be avoided, though we'll indeed
> > > have to handle conflicts with existing matcher syntax. Or use another
> > > separator? Any other idea welcome!
> > 
> > How about extending the fileset syntax?
> > 
> >   $ hg log/annotate 'set:FILE:linerange(FROMLINE-TOLINE)'
> >                              # ':' attr-name '(' args ')'
> 
> I think adding new pattern like "(rel)linerange:PATH:L1-L2" is cleaner.
> 
> Reasons:
> 
>   - It's rare to specify a same line range for different files.
>   - If it was added to "set:", how about other patterns like "glob:",
>     "path:", "include:", ...?
>     If they all need to support the new syntax. It could introduce ambiguity.
> 
> As a user, I want to type commands as short as possible. So "set:" is not
> pretty.

Nah, not pretty. I like --line-range L1-L2 for simple case where only one
file is involved.

> I think the "default" parameter of match.__init__ could be made to
> support a list, like ['glob', 'rellinerange'] and tries them one by one. If
> BC is a concern, a config option could be introduced.
> 
> Eventually, if it is just so useful, I think it can be made to be the
> default behavior.

If we can do that, I think that's fine. I wanted to tell that filesets has
unused characters which can be used for future extension without BC.


More information about the Mercurial-devel mailing list