Bug 4307 - hg log filename' does not show tip cset
Summary: hg log filename' does not show tip cset
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: evolution (show other bugs)
Version: 3.0.1
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks: 4747
  Show dependency tree
 
Reported: 2014-07-17 11:01 UTC by Faheem Mitha
Modified: 2015-07-06 20:38 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments
Test repository exhibiting the problem (13.34 KB, application/x-gzip)
2014-07-17 11:01 UTC, Faheem Mitha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Faheem Mitha 2014-07-17 11:01 UTC
Created attachment 1781 [details]
Test repository exhibiting the problem

For the test repository, observe the following:

faheem@orwell:~/test-evolve$ hg log -vG  -r 23 --stat --hidden
@  changeset:   23:b2966c6c2bba
|  tag:         tip
|  user:        Faheem Mitha <faheem@faheem.info>
|  date:        Fri Jul 11 18:46:37 2014 +0530
|  files:       bar
|  description:
|  New file bar
|
|
|   bar |  3 +++
|   1 files changed, 3 insertions(+), 0 deletions(-)
|

faheem@orwell:~/test-evolve$ hg log -vG  -r 23 bar --stat --hidden
[Returns nothing]

Bar was created in cset 23, 
but `hg log bar` and variations returns nothing.

faheem@orwell:~/test-evolve$ hg phase -r 23
23: public

faheem@orwell:~/test-evolve$ hg --version
Mercurial Distributed SCM (version 3.0.1)

This was also mentioned in an email to mercurial@selenic.com, with the title 
'hg log filename' does not show tip cset
that was sent today. But at time of writing this does not show up in the mailing list archives.
Comment 1 Matt Mackall 2014-07-17 16:46 UTC
Appears to be a duplicate of the classic linkrev bug (bug 3004).

$ hg debugindex bar
   rev    offset  length   base linkrev nodeid       p1           p2
     0         0      16      0      19 dd12636e8abe 000000000000 000000000000

This seems to be interacting extra-badly with hidden changesets, so probably warrants extra attention.
Comment 2 Pierre-Yves David 2014-07-18 02:53 UTC
Yop, linkrev + hidden changelog entry → bad things happen. Need a rework of linkrev.
Comment 3 HG Bot 2015-01-05 17:00 UTC
Fixed by http://selenic.com/repo/hg/rev/8ec03e0ef51a
Pierre-Yves David <pierre-yves.david@fb.com>
linkrev-filelog: handle filtered linkrev with no visible children (issue4307)

If the file revision with a filtered linkrev does not have any
(unfiltered) children, we cannot use it to bound the search for
another introduction. Instead, we have to look at the file revision
used by each head changeset. If one of them uses this file revision, we
know there is another occurrence and we have a starting point. See
inline comments for details.

Adding some kind of permanent reference of all the introductions of a
file revision instead of just the first one would be much better. But
this is more difficult. I hope to take that into account in the next
repository format.

(please test the fix)
Comment 4 Faheem Mitha 2015-01-21 15:24 UTC
I downloaded my own attachment and ran the commands below with 3.3 rc and evolve default brahch, with tip/head de73285cf50. I can still reproduce it. As in, I get exactly the same results. Am I missing something?
Comment 5 Pierre-Yves David 2015-01-21 15:30 UTC
I guess that this file revision have been introduced by another visible changesets. That case is not fixed yet see issue 3004
Comment 6 Faheem Mitha 2015-01-21 15:33 UTC
Per Pierre-Yves suggestion:

aheem@orwell:/tmp/test-evolve$ hg log -vGf  -r 23 bar --stat --hidden
@  changeset:   23:b2966c6c2bba
|  tag:         tip
|  user:        Faheem Mitha <faheem@faheem.info>
|  date:        Fri Jul 11 18:46:37 2014 +0530
|  files:       bar
|  description:
|  New file bar
|
|
|

So it works if I do `-f`.
Comment 7 Faheem Mitha 2015-01-21 15:54 UTC
As pointed out by Sean, if one alternatively does

 hg log -vG  -r 23 bar --stat

without the --hidden, it also works. I.e.

faheem@orwell:/tmp/test-evolve$ hg log -vG  -r 23 bar --stat
@  changeset:   23:b2966c6c2bba
|  tag:         tip
|  user:        Faheem Mitha <faheem@faheem.info>
|  date:        Fri Jul 11 18:46:37 2014 +0530
|  files:       bar
|  description:
|  New file bar
|
|
|   bar |  3 +++
|   1 files changed, 3 insertions(+), 0 deletions(-)
|

I don't understand what the reason for this could be, though.
Comment 8 Bugzilla 2015-01-29 01:00 UTC
Bug was set to TESTING for 7 days, resolving
Comment 9 Faheem Mitha 2015-01-29 02:57 UTC
Nobody responded to my comment wrt to why --hidden makes the log entry disappear. In any case, can someone else verify this? It seems to me like a bug.
Comment 10 Pierre-Yves David 2015-01-29 03:28 UTC
Each file revision is reported once. Adding --hidden reveal an earlier introduction of this file revision, changing the revision for which it is reported.

Known 10 years old issue, the situation improved significantly this cycle but there is still room for improvement.
Comment 11 Matt Mackall 2015-01-29 11:52 UTC
Tip with your test repo:

$ hg log bar
changeset:   23:b2966c6c2bba
tag:         tip
user:        Faheem Mitha <faheem@faheem.info>
date:        Fri Jul 11 18:46:37 2014 +0530
summary:     New file bar

$ hg log bar --hidden
changeset:   19:d03de61c795e
user:        Faheem Mitha <faheem@faheem.info>
date:        Fri Jul 11 14:27:11 2014 +0530
summary:     temporary amend commit for d3ad107c8e38

Note that the hidden view of things is _different_: bar was introduced at 19 and 23 is just a duplicate reintroduction of the same change. Mercurial has always shown just one such duplicate. So this shows nothing, because in --hidden-land, we know the only answer is 19:

$ hg log bar --hidden -r 23

The bug that's marked "fixed" here is the fact that "hg log bar" showed nothing. The "log of a file doesn't show duplicates" thing is unlikely to change and is in fact documented:

    Note:
       for performance reasons, log FILE may omit duplicate changes made on
       branches and will not show removals or mode changes. To see all such
       changes, use the --removed switch.

$ hg log --removed bar --hidden
changeset:   23:b2966c6c2bba
tag:         tip
user:        Faheem Mitha <faheem@faheem.info>
date:        Fri Jul 11 18:46:37 2014 +0530
summary:     New file bar

changeset:   21:5d1003c05f55
parent:      13:2d385d13e54d
user:        Faheem Mitha <faheem@faheem.info>
date:        Fri Jul 11 14:27:14 2014 +0530
summary:     Add Lines 8 and 9 to foo. Add bar with Lines 1 and 2.

changeset:   20:fb9ccc346c57
parent:      13:2d385d13e54d
user:        Faheem Mitha <faheem@faheem.info>
date:        Fri Jul 11 14:27:11 2014 +0530
summary:     Add Lines 8 and 9 to foo.

changeset:   19:d03de61c795e
user:        Faheem Mitha <faheem@faheem.info>
date:        Fri Jul 11 14:27:11 2014 +0530
summary:     temporary amend commit for d3ad107c8e38
Comment 12 Faheem Mitha 2015-01-29 12:26 UTC
Thanks for the detailed analysis, Matt. It was very helpful.