summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-08-21 16:33:36 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-08-21 22:00:32 +0200
commite142ba8247276d25b3ff47e8f9fed06d0cc4753a (patch)
tree5074845aa255e20067dc74c54ae88c90c9ba064b
parent4e0e78dbd9b86880582be062a4e75834f2e390d2 (diff)
downloadpylint-git-e142ba8247276d25b3ff47e8f9fed06d0cc4753a.tar.gz
Fix ``mypy`` issues in primer
-rw-r--r--pylint/testutils/_primer/package_to_lint.py19
-rw-r--r--pylint/testutils/_primer/primer_prepare_command.py7
2 files changed, 14 insertions, 12 deletions
diff --git a/pylint/testutils/_primer/package_to_lint.py b/pylint/testutils/_primer/package_to_lint.py
index 0492c3a8b..b6ccc8b8b 100644
--- a/pylint/testutils/_primer/package_to_lint.py
+++ b/pylint/testutils/_primer/package_to_lint.py
@@ -7,7 +7,8 @@ from __future__ import annotations
import logging
from pathlib import Path
-import git
+from git.cmd import Git
+from git.repo import Repo
PRIMER_DIRECTORY_PATH = Path("tests") / ".pylint_primer_tests"
@@ -92,22 +93,22 @@ class PackageToLint:
"depth": 1,
}
logging.info("Directory does not exists, cloning: %s", options)
- repo = git.Repo.clone_from(**options)
- return repo.head.object.hexsha
+ repo = Repo.clone_from(
+ url=self.url, to_path=self.clone_directory, branch=self.branch, depth=1
+ )
+ return str(repo.head.object.hexsha)
- remote_sha1_commit = (
- git.cmd.Git().ls_remote(self.url, self.branch).split("\t")[0]
- )
- local_sha1_commit = git.Repo(self.clone_directory).head.object.hexsha
+ remote_sha1_commit = Git().ls_remote(self.url, self.branch).split("\t")[0]
+ local_sha1_commit = Repo(self.clone_directory).head.object.hexsha
if remote_sha1_commit != local_sha1_commit:
logging.info(
"Remote sha is '%s' while local sha is '%s': pulling new commits",
remote_sha1_commit,
local_sha1_commit,
)
- repo = git.Repo(self.clone_directory)
+ repo = Repo(self.clone_directory)
origin = repo.remotes.origin
origin.pull()
else:
logging.info("Repository already up to date.")
- return remote_sha1_commit
+ return str(remote_sha1_commit)
diff --git a/pylint/testutils/_primer/primer_prepare_command.py b/pylint/testutils/_primer/primer_prepare_command.py
index 9fec829bc..83b3a2b96 100644
--- a/pylint/testutils/_primer/primer_prepare_command.py
+++ b/pylint/testutils/_primer/primer_prepare_command.py
@@ -3,7 +3,8 @@
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
from __future__ import annotations
-import git
+from git.cmd import Git
+from git.repo import Repo
from pylint.testutils._primer.primer_command import PrimerCommand
@@ -18,13 +19,13 @@ class PrepareCommand(PrimerCommand):
commit_string += local_commit + "_"
elif self.config.check:
for package, data in self.packages.items():
- local_commit = git.Repo(data.clone_directory).head.object.hexsha
+ local_commit = Repo(data.clone_directory).head.object.hexsha
print(f"Found '{package}' at commit '{local_commit}'.")
commit_string += local_commit + "_"
elif self.config.make_commit_string:
for package, data in self.packages.items():
remote_sha1_commit = (
- git.cmd.Git().ls_remote(data.url, data.branch).split("\t")[0]
+ Git().ls_remote(data.url, data.branch).split("\t")[0]
)
print(f"'{package}' remote is at commit '{remote_sha1_commit}'.")
commit_string += remote_sha1_commit + "_"