diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1022,8 +1022,6 @@ def walkchangerevs(repo, match, opts, pr follow = opts.get('follow') or opts.get('follow_first') - if not len(repo): - return [] if opts.get('rev'): revs = scmutil.revrange(repo, opts.get('rev')) elif follow: diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -771,6 +771,10 @@ class revlog(object): nl = [n for n in nl if hex(n).startswith(id)] if len(nl) > 0: if len(nl) == 1: + if nl[0] == nullid: + # dummy null revision always exists, + # it shouldn't be returned here + return None self._pcache[id] = nl[0] return nl[0] raise LookupError(id, self.indexfile, diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -238,12 +238,10 @@ def rangeset(repo, subset, x, y): return [x for x in r if x in s] def dagrange(repo, subset, x, y): - if subset: - r = list(repo) - xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y)) - s = set(subset) - return [r for r in xs if r in s] - return [] + r = list(repo) + xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y)) + s = set(subset) + return [r for r in xs if r in s] def andset(repo, subset, x, y): return getset(repo, getset(repo, subset, x), y) diff --git a/tests/test-alias.t b/tests/test-alias.t --- a/tests/test-alias.t +++ b/tests/test-alias.t @@ -267,10 +267,13 @@ shell aliases with global options $ hg init sub $ cd sub $ hg count 'branch(default)' + abort: unknown revision 'default'! 0 $ hg -v count 'branch(default)' + abort: unknown revision 'default'! 0 $ hg -R .. count 'branch(default)' + abort: unknown revision 'default'! 0 $ hg --cwd .. count 'branch(default)' 2 diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -1542,6 +1542,7 @@ have 2 filelog topological heads in a li $ testlog --follow [] [] + abort: unknown revision '0'! $ echo a > a $ echo aa > aa $ echo f > f diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1,3 +1,20 @@ +Log on empty repository: checking consistency + + $ hg init empty + $ cd empty + $ hg log + $ hg log -r 1 + abort: unknown revision '1'! + [255] + $ hg log -r -1:0 + abort: unknown revision '-1'! + [255] + $ hg log -r 'branch(name)' + abort: unknown revision 'name'! + [255] + $ hg log -r null -q + -1:000000000000 + The g is crafted to have 2 filelog topological heads in a linear changeset graph