diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -18,6 +18,7 @@ from .i18n import _ from .node import ( + bin, hex, nullid, short, @@ -475,8 +476,20 @@ except (ValueError, OverflowError, IndexError): pass + if len(symbol) == 40: + try: + node = bin(symbol) + rev = repo.changelog.rev(node) + return repo[rev] + except error.FilteredLookupError: + raise + except (TypeError, LookupError): + pass + return repo[symbol] + except error.WdirUnsupported: + return repo[None] except (error.FilteredIndexError, error.FilteredLookupError, error.FilteredRepoLookupError): raise _filterederror(repo, symbol)