if instead of try / catch

This commit is contained in:
Dani Hodovic
2019-12-05 21:05:02 +01:00
parent 9ece4ed8ad
commit f829338e1e
+3 -5
View File
@@ -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)