# HG changeset patch # User Marcin Kuzminski # Date 2017-02-08 20:30:01 # Node ID a1d7ee0596d395d4b9759cefe50063e1e93c6403 # Parent c758a5ddd76d52d373e5bef085cc9d5e67bba1ab 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)