aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps/detector.py
diff options
context:
space:
mode:
Diffstat (limited to 'git_deps/detector.py')
-rw-r--r--git_deps/detector.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py
index df5b001..ddbdf9c 100644
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -163,13 +163,7 @@ class DependencyDetector(object):
# which was not previously in the parent.
return
- cmd = [
- 'git', 'blame',
- '--porcelain',
- '-L', "%d,+%d" % (hunk.old_start, hunk.old_lines),
- parent.hex, '--', path
- ]
- blame = subprocess.check_output(cmd, universal_newlines=True)
+ blame = self.run_blame(hunk, parent, path)
dependent_sha1 = dependent.hex
if dependent_sha1 not in self.dependencies:
@@ -265,6 +259,15 @@ class DependencyDetector(object):
self.logger.debug(diff_format %
(rev, ln, line.origin, line.content.rstrip()))
+ def run_blame(self, hunk, parent, path):
+ cmd = [
+ 'git', 'blame',
+ '--porcelain',
+ '-L', "%d,+%d" % (hunk.old_start, hunk.old_lines),
+ parent.hex, '--', path
+ ]
+ return subprocess.check_output(cmd, universal_newlines=True)
+
def is_excluded(self, commit):
if self.options.exclude_commits is not None:
for exclude in self.options.exclude_commits: