# HG changeset patch # User Marcin Kuzminski # Date 2017-02-08 20:30:01 # Node ID 81fbc95e344b03045f705eb6335c0fc4ba2ead55 # Parent a6bc3e0e65d2790f5f5591025713cd3155beb60d backends: make HG repos throw same kind of CommitDoesNotExist errors like other backends. diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- 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)