summaryrefslogtreecommitdiff
path: root/pylint/testutils
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-02-06 15:58:55 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2023-02-06 17:56:55 +0100
commit257ca10a9beabe75707646ed4d03c358a199d5f5 (patch)
tree85616fe6eb0d4b12e0cd6bc729e8548058cb0fd7 /pylint/testutils
parent8478ea04f1f614f94f0d5859b07771ff1e00c6e7 (diff)
downloadpylint-git-257ca10a9beabe75707646ed4d03c358a199d5f5.tar.gz
[primer --prepare clone] Better error message in case of crash
Diffstat (limited to 'pylint/testutils')
-rw-r--r--pylint/testutils/_primer/package_to_lint.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pylint/testutils/_primer/package_to_lint.py b/pylint/testutils/_primer/package_to_lint.py
index 09ecb4456..0427e9a0b 100644
--- a/pylint/testutils/_primer/package_to_lint.py
+++ b/pylint/testutils/_primer/package_to_lint.py
@@ -8,6 +8,7 @@ import logging
import sys
from pathlib import Path
+from git import GitCommandError
from git.cmd import Git
from git.repo import Repo
@@ -117,9 +118,17 @@ class PackageToLint:
remote_sha1_commit,
local_sha1_commit,
)
- repo = Repo(self.clone_directory)
- origin = repo.remotes.origin
- origin.pull()
+ self._clone_repository()
else:
logging.info("Repository already up to date.")
return str(remote_sha1_commit)
+
+ def _clone_repository(self) -> None:
+ try:
+ repo = Repo(self.clone_directory)
+ origin = repo.remotes.origin
+ origin.pull()
+ except GitCommandError as e:
+ raise SystemError(
+ f"Failed to clone repository for {self.clone_directory}"
+ ) from e