##// END OF EJS Templates
mercurial: improve lookup logic and chained exceptions that can happen during that operation.
super-admin -
r1142:8f4053f9 default
parent child Browse files
Show More
@@ -74,15 +74,19 b' from mercurial import strip as hgext_str'
74 def get_ctx(repo, ref):
74 def get_ctx(repo, ref):
75 if not isinstance(ref, int):
75 if not isinstance(ref, int):
76 ref = safe_bytes(ref)
76 ref = safe_bytes(ref)
77
77 try:
78 try:
78 ctx = repo[ref]
79 ctx = repo[ref]
80 return ctx
79 except (ProgrammingError, TypeError):
81 except (ProgrammingError, TypeError):
80 # we're unable to find the rev using a regular lookup, we fallback
82 # we're unable to find the rev using a regular lookup, we fallback
81 # to slower, but backward compat revsymbol usage
83 # to slower, but backward compat revsymbol usage
82 ctx = revsymbol(repo, ref)
84 pass
83 except (LookupError, RepoLookupError):
85 except (LookupError, RepoLookupError):
84 # Similar case as above but only for refs that are not numeric
86 # Similar case as above but only for refs that are not numeric
85 if isinstance(ref, int):
87 if isinstance(ref, int):
86 raise
88 raise
87 ctx = revsymbol(repo, ref)
89
90 ctx = revsymbol(repo, ref)
91
88 return ctx
92 return ctx
General Comments 0
You need to be logged in to leave comments. Login now