diff -r 482a6aac1f15 -r 967e2e81f762 mercurial/revset.py --- a/mercurial/revset.py Sat Mar 21 13:27:47 2020 +0900 +++ b/mercurial/revset.py Sat Mar 21 13:39:39 2020 +0900 @@ -2109,7 +2109,10 @@ # i18n: "rev" is a keyword raise error.ParseError(_(b"rev expects a number")) if l not in _virtualrevs: - repo.changelog.node(l) # check that the rev exists + try: + repo.changelog.node(l) # check that the rev exists + except IndexError: + raise error.RepoLookupError(_(b"unknown revision '%d'") % l) return subset & baseset([l])