aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2018-09-09 21:25:44 +0100
committerAdam Spiers <git@adamspiers.org>2018-09-09 22:02:03 +0100
commit4fd28c7326125260acaefdb9bbae2907bb028b71 (patch)
tree29fd91c0699eeab60f2a4a916008e65f1f00ac97 /git_deps
parent27113c37aa2cbbc753d7957414696c09a361b0fd (diff)
downloadgit-deps-4fd28c7326125260acaefdb9bbae2907bb028b71.tar.gz
extract register_new_dependent() method
Diffstat (limited to 'git_deps')
-rw-r--r--git_deps/detector.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py
index 9bf9944..e82536f 100644
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -166,11 +166,7 @@ class DependencyDetector(object):
blame = self.run_blame(hunk, parent, path)
dependent_sha1 = dependent.hex
- if dependent_sha1 not in self.dependencies:
- self.logger.debug(" New dependent: %s" %
- GitUtils.commit_summary(dependent))
- self.dependencies[dependent_sha1] = {}
- self.notify_listeners("new_dependent", dependent)
+ self.register_new_dependent(dependent, dependent_sha1)
line_to_culprit = {}
@@ -259,6 +255,13 @@ class DependencyDetector(object):
self.logger.debug(diff_format %
(rev, ln, line.origin, line.content.rstrip()))
+ def register_new_dependent(self, dependent, dependent_sha1):
+ if dependent_sha1 not in self.dependencies:
+ self.logger.debug(" New dependent: %s" %
+ GitUtils.commit_summary(dependent))
+ self.dependencies[dependent_sha1] = {}
+ self.notify_listeners("new_dependent", dependent)
+
def run_blame(self, hunk, parent, path):
cmd = [
'git', 'blame',