aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps/detector.py
diff options
context:
space:
mode:
authorAntonin Delpeuch <antonin@delpeuch.eu>2023-09-24 10:29:05 +0200
committerAntonin Delpeuch <antonin@delpeuch.eu>2023-09-24 10:29:05 +0200
commitb0d5a8dcbc033bab0a97383b2082e09ccf698dd7 (patch)
tree64f4a27d45553fc977a621b4f356134f585d17ba /git_deps/detector.py
parent70fdff7898416dfa26999194c387abdd17e8acb8 (diff)
downloadgit-deps-b0d5a8dcbc033bab0a97383b2082e09ccf698dd7.tar.gz
Only use pygit2's blame via opt-in
This can be reconsidered if pygit2's blame algorithm improves. The option can still be useful if the 'git' command is not available on the system.
Diffstat (limited to 'git_deps/detector.py')
-rw-r--r--git_deps/detector.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py
index a7036c9..82996a6 100644
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -7,6 +7,7 @@ from git_deps.utils import abort, standard_logger
from git_deps.gitutils import GitUtils
from git_deps.listener.base import DependencyListener
from git_deps.errors import InvalidCommitish
+from git_deps.blame import blame_via_subprocess
class DependencyDetector(object):
@@ -236,10 +237,16 @@ class DependencyDetector(object):
self.notify_listeners("new_dependent", dependent)
def run_blame(self, hunk, parent, path):
- return self.repo.blame(path,
- newest_commit=parent.hex,
- min_line=hunk.old_start,
- max_line=hunk.old_start + hunk.old_lines - 1)
+ if self.options.pygit2_blame:
+ return self.repo.blame(path,
+ newest_commit=parent.hex,
+ min_line=hunk.old_start,
+ max_line=hunk.old_start + hunk.old_lines - 1)
+ else:
+ return blame_via_subprocess(path,
+ parent.hex,
+ hunk.old_start,
+ hunk.old_lines)
def is_excluded(self, commit):
if self.options.exclude_commits is not None: