##// END OF EJS Templates
git: fix lookups....
milka -
r4656:a9d6cd92 default
parent child Browse files
Show More
@@ -241,24 +241,32 b' class GitRepository(BaseRepository):'
241 241
242 242 is_bstr = isinstance(commit_id_or_idx, (str, unicode))
243 243 is_branch = reference_obj and reference_obj.branch
244 is_numeric_idx = \
245 (is_bstr and commit_id_or_idx.isdigit() and len(commit_id_or_idx) < 12) \
246 or isinstance(commit_id_or_idx, int)
247 244
248 if not is_branch and (is_numeric_idx or is_null(commit_id_or_idx)):
249 try:
250 commit_id_or_idx = self.commit_ids[int(commit_id_or_idx)]
251 except Exception:
252 raise CommitDoesNotExistError(commit_missing_err)
253
254 elif is_bstr:
245 lookup_ok = False
246 if is_bstr:
255 247 # Need to call remote to translate id for tagging scenarios,
256 248 # or branch that are numeric
257 249 try:
258 250 remote_data = self._remote.get_object(commit_id_or_idx,
259 251 maybe_unreachable=maybe_unreachable)
260 252 commit_id_or_idx = remote_data["commit_id"]
253 lookup_ok = True
261 254 except (CommitDoesNotExistError,):
255 lookup_ok = False
256
257 if lookup_ok is False:
258 is_numeric_idx = \
259 (is_bstr and commit_id_or_idx.isdigit() and len(commit_id_or_idx) < 12) \
260 or isinstance(commit_id_or_idx, int)
261 if not is_branch and (is_numeric_idx or is_null(commit_id_or_idx)):
262 try:
263 commit_id_or_idx = self.commit_ids[int(commit_id_or_idx)]
264 lookup_ok = True
265 except Exception:
266 raise CommitDoesNotExistError(commit_missing_err)
267
268 # we failed regular lookup, and by integer number lookup
269 if lookup_ok is False:
262 270 raise CommitDoesNotExistError(commit_missing_err)
263 271
264 272 # Ensure we return full id
General Comments 0
You need to be logged in to leave comments. Login now