From eadfaeb34aa473dca4852bdd8c6fb635b4e5d8f9 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Wed, 8 Feb 2017 21:30:01 +0100 Subject: [PATCH] backends: make HG repos throw same kind of CommitDoesNotExist errors like other backends. --- rhodecode/lib/vcs/backends/hg/repository.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py index fd7499e7..36b34bc2 100644 --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -445,7 +445,12 @@ class MercurialRepository(BaseRepository): if isinstance(commit_id, unicode): commit_id = safe_str(commit_id) - raw_id, idx = self._remote.lookup(commit_id, both=True) + try: + raw_id, idx = self._remote.lookup(commit_id, both=True) + except CommitDoesNotExistError: + msg = "Commit %s does not exist for %s" % ( + commit_id, self) + raise CommitDoesNotExistError(msg) return MercurialCommit(self, raw_id, idx, pre_load=pre_load)