[PATCH V2] (was Re: [PATCH STABLE] log --follow shouldn't depend on the working dir context)

Patrick Mézard patrick at mezard.eu
Wed Jun 13 04:55:41 CDT 2012


Le 12/06/12 23:34, Christian Boos a écrit :
> On 6/12/2012 2:39 PM, Patrick Mézard wrote:
>> Le 11/06/12 22:39, Christian Boos a écrit :

[...]

> Note that there is a precedent for that in "hg log --follow -r REV",
> i.e. when no file is specified. There you can also have a very
> different result depending on the revision order given in the range.
> Consider:
> 
> $ hg glog --template="\t{branch} {rev}\n"
> @       A 5
> |
> | o     B 4
> | |
> o |     A 3
> | |
> | o     B 2
> | |
> | o     B 1
> |
> o       A 0
> 
> $ hg log --follow --template '{branch} {rev}\n' -r 4:0
> B 4
> B 2
> B 1
> 
> $ hg log --follow --template '{branch} {rev}\n' -r 0:4
> A 0
> A 3
> 
> From a user perspective I think that the usage pattern is similar, the
> start revision determines which "branch" is picked, the changelog
> branch in the above example, the filelog branch in case of --follow
> file.
> 
> On the opposite, if you had a dedicated option like --pathrev as you
> suggested, users would have to deal with two similar notions of "start
> revisions", and it might be tricky to explain the subtle difference
> between them. And even if the difference is plain clear, I'm not sure
> if there are many use cases where you would them to be different,
> except when you'd like to reverse the display order as in your example.
> IMO, having an extra option is not a clear win, it's certainly more
> precise but comes at the price of added user interface complexity.

The real conflict is between simple revision range and revsets.

You are correct about the --follow without argument logic. At the same time, I cannot remember the last time I used that option instead of "x::" or "::x".

So when you say:

  $ hg log --follow FILE -r "4:7"

clearly says "resolve FILE in 4 and follow its history up to 7", I can agree with you.

But there should be a better way to make the following work:

  $ hg log --follow FILE -r "::."

than fiddling with the revset to get:

  $ hg log --follow FILE -r "reverse(::.)"

So, whatever we decide, I believe --file-rev, or even --follow-rev could be useful to disambiguate file resolution with complex revset expressions. The question is what happens with "--follow FILE --rev x:y". Having --follow-rev, I have not much against what you propose.

We should wait for Matt opinion about this before writing more patches.

--
Patrick Mézard


More information about the Mercurial-devel mailing list