# HG changeset patch # User RhodeCode Admin # Date 2023-08-04 20:57:24 # Node ID 8f4053f9fdd4792007d9680addace6748bbedf93 # Parent 9ac2e7b2f1d5e75bee948f6ef443d34d96cf870b mercurial: improve lookup logic and chained exceptions that can happen during that operation. 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