Bug 4512 - log with --follow flag does not work for null revision
Summary: log with --follow flag does not work for null revision
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 3.2.4
Hardware: PC Windows
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-25 04:46 UTC by Sergey Antonov
Modified: 2015-02-02 01:00 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Antonov 2015-01-25 04:46 UTC
I'm working on mercurial integration with MS Visual Studio.
Now i'm trying to migrate from Mercurial 2.3 to Mercurial 3.x, but found a bug (or breaking change).

The following command output nothing:
hg log --follow --rev null

while log without follow works fine:
d:\Work\Mercurial\Tests1\LogNullTest>hg log --rev null
changeset:   -1:000000000000
user:
date:        Thu Jan 01 00:00:00 1970 +0000

Also, log with --follow works fine for any other revisions but null.
A while back (in mercurial v2.3 and earlier) it worked for null revision.

Here are steps to reproduce:

d:\Work\Mercurial\Tests1\LogNullTest>hg init
d:\Work\Mercurial\Tests1\LogNullTest>echo a > a.txt
d:\Work\Mercurial\Tests1\LogNullTest>hg add a.txt
d:\Work\Mercurial\Tests1\LogNullTest>hg ci -m "added a.txt"

d:\Work\Mercurial\Tests1\LogNullTest>hg log
changeset:   0:d7db1a6e60d9
tag:         tip
user:        Sergey Antonov <sergant_@mail.ru>
date:        Sun Jan 25 12:36:37 2015 +0300
summary:     added a.txt


d:\Work\Mercurial\Tests1\LogNullTest>hg log --follow --rev null

d:\Work\Mercurial\Tests1\LogNullTest>hg log --rev null
changeset:   -1:000000000000
user:
date:        Thu Jan 01 00:00:00 1970 +0000


d:\Work\Mercurial\Tests1\LogNullTest>hg log --rev 0
changeset:   0:d7db1a6e60d9
tag:         tip
user:        Sergey Antonov <sergant_@mail.ru>
date:        Sun Jan 25 12:36:37 2015 +0300
summary:     added a.txt


d:\Work\Mercurial\Tests1\LogNullTest>hg log --follow --rev 0
changeset:   0:d7db1a6e60d9
tag:         tip
user:        Sergey Antonov <sergant_@mail.ru>
date:        Sun Jan 25 12:36:37 2015 +0300
summary:     added a.txt
Comment 1 Yuya Nishihara 2015-01-25 05:53 UTC
The first bad revision is:

changeset:   21127:69402eb72115
user:        Lucas Moscovicz <lmoscovicz@fb.com>
date:        Fri Feb 28 15:10:56 2014 -0800
files:       mercurial/cmdutil.py mercurial/commands.py tests/test-glog.t
description:
log: changed implementation to use graphlog code


It seems the graphlog code can't handle --follow -r null correctly.
There are two issues involved:

1. cmdutil._makelogrevset() maps "--follow -r null" to "ancestors(-1)",
   which should be "ancestors(null)"
2. "ancestors(null)" revset does not include "null"
Comment 2 HG Bot 2015-01-25 21:46 UTC
Fixed by http://selenic.com/repo/hg/rev/b1e026c25552
Yuya Nishihara <yuya@tcha.org>
revset: fix ancestors(null) to include null revision (issue4512)

Since 13c0327eeb6f, null parent is explicitly excluded. So, there is no reason
to have nullrev in the initial seen set.

(please test the fix)
Comment 3 Bugzilla 2015-02-02 01:00 UTC
Bug was set to TESTING for 7 days, resolving