diff --git a/vcsserver/hgcompat.py b/vcsserver/hgcompat.py --- a/vcsserver/hgcompat.py +++ b/vcsserver/hgcompat.py @@ -74,15 +74,19 @@ from mercurial import strip as hgext_str def get_ctx(repo, ref): if not isinstance(ref, int): ref = safe_bytes(ref) + try: ctx = repo[ref] + return ctx except (ProgrammingError, TypeError): # we're unable to find the rev using a regular lookup, we fallback # to slower, but backward compat revsymbol usage - ctx = revsymbol(repo, ref) + pass except (LookupError, RepoLookupError): # Similar case as above but only for refs that are not numeric if isinstance(ref, int): raise - ctx = revsymbol(repo, ref) + + ctx = revsymbol(repo, ref) + return ctx