From f829338e1eecb94735bbb13f97661e07457428cb Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Tue, 3 Dec 2019 14:06:49 +0100 Subject: [PATCH] if instead of try / catch --- dvc/repo/get.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dvc/repo/get.py b/dvc/repo/get.py index 24d1ae81a..d07251f82 100644 --- a/dvc/repo/get.py +++ b/dvc/repo/get.py @@ -21,11 +21,9 @@ logger = logging.getLogger(__name__) def copy_git_file(repo, src, dst): - try: - # Assert that the file does indeed exist in git before attempting to - # copy it. - repo.scm.repo.head.commit.tree[src] # noqa - except KeyError: + # Assert that the file does indeed exist in git before attempting to + # copy it. + if src not in repo.scm.repo.head.commit.tree: raise FileOutsideRepoError(src) src_full_path = os.path.join(repo.root_dir, src)