diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1033,6 +1033,8 @@ def walkchangerevs(ui, repo, pats, chang if node is None: # A zero count may be a directory or deleted file, so # try to find matching entries on the slow path. + if follow: + raise util.Abort(_('cannot follow nonexistent file: "%s"') % file_) slowpath = True break else: diff --git a/tests/test-log.out b/tests/test-log.out --- a/tests/test-log.out +++ b/tests/test-log.out @@ -5,7 +5,7 @@ date: Thu Jan 01 00:00:01 1970 +0 summary: a % -f, directory -abort: can only follow copies/renames for explicit file names +abort: cannot follow nonexistent file: "dir" % -f, but no args changeset: 4:b30c444c7c84 tag: tip