# HG changeset patch # User Yuya Nishihara # Date 1423227219 -32400 # Node ID c260887cdbcd5396bae08f8b1f61a14be5bc283b # Parent c98fa0ca46787b533b9bb9690bc24daaa7819264 log: fix --follow null parent not to include revision 0 If p1 is null, ':.' is translated as '0:null'. But rangeset can't handle null, only revision 0 was visible. Because 'null' should not be listed implicitly, "log --follow" (without -r) should be empty if p1 is null. Test of "hg grep -f" is added for cmdutil.walkchangerevs(). diff -r c98fa0ca4678 -r c260887cdbcd mercurial/cmdutil.py --- a/mercurial/cmdutil.py Fri Feb 06 00:22:20 2015 +0900 +++ b/mercurial/cmdutil.py Fri Feb 06 21:53:39 2015 +0900 @@ -1821,6 +1821,8 @@ follow = opts.get('follow') or opts.get('follow_first') if opts.get('rev'): revs = scmutil.revrange(repo, opts['rev']) + elif follow and repo.dirstate.p1() == nullid: + revs = revset.baseset() elif follow: revs = repo.revs('reverse(:.)') else: diff -r c98fa0ca4678 -r c260887cdbcd tests/test-glog.t --- a/tests/test-glog.t Fri Feb 06 00:22:20 2015 +0900 +++ b/tests/test-glog.t Fri Feb 06 21:53:39 2015 +0900 @@ -1767,6 +1767,13 @@ nodetag 1 nodetag 0 +Test --follow null parent + + $ hg up -q null + $ testlog -f + [] + [] + Test --follow-first $ hg up -q 3 diff -r c98fa0ca4678 -r c260887cdbcd tests/test-grep.t --- a/tests/test-grep.t Fri Feb 06 00:22:20 2015 +0900 +++ b/tests/test-grep.t Fri Feb 06 21:53:39 2015 +0900 @@ -82,6 +82,10 @@ port:1:2:+:eggs:export port:0:1:+:spam:import + $ hg up -q null + $ hg grep -f port + [1] + $ cd .. $ hg init t2 $ cd t2 diff -r c98fa0ca4678 -r c260887cdbcd tests/test-log.t --- a/tests/test-log.t Fri Feb 06 00:22:20 2015 +0900 +++ b/tests/test-log.t Fri Feb 06 21:53:39 2015 +0900 @@ -672,10 +672,17 @@ +log -f with null parent + + $ hg up -C null + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg log -f + + log -r . with two parents $ hg up -C 3 - 2 files updated, 0 files merged, 1 files removed, 0 files unresolved + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge tip 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit)