aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2016-07-03 09:21:12 -0600
committerAdam Spiers <git@adamspiers.org>2018-05-15 13:42:16 +0100
commitd52d9e778e793ee12f01be3fbfdeaef6843688da (patch)
treec163cf0d8fd0543022f360a29d23e21b99c530d3 /git_deps
parent5d2d6a08865c71bd8cff2906d77b9c82bc1c6334 (diff)
downloadgit-deps-d52d9e778e793ee12f01be3fbfdeaef6843688da.tar.gz
notify of new dependency even if target already done
When a new dependency is discovered, its target may have already been placed on the TODO list via a different source (and maybe even analysed for dependencies), e.g. if find_dependencies() was previously called on it, or if it was previously found via recursion. In this case we still need to notify listeners of the dependency, even though we won't add it to the TODO list.
Diffstat (limited to 'git_deps')
-rw-r--r--git_deps/detector.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py
index 1c78a42..3111a38 100644
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -198,6 +198,18 @@ class DependencyDetector(object):
continue
if dependency_sha1 not in self.dependencies[dependent_sha1]:
+ if not self.seen_commit(dependency):
+ self.notify_listeners("new_commit", dependency)
+ self.dependencies[dependent_sha1][dependency_sha1] = {}
+
+ self.notify_listeners("new_dependency",
+ dependent, dependency, path, line_num)
+
+ self.logger.debug(
+ " New dependency %s -> %s via line %s (%s)" %
+ (dependent_sha1[:8], dependency_sha1[:8], line_num,
+ GitUtils.oneline(dependency)))
+
if dependency_sha1 in self.todo_d:
self.logger.debug(
" Dependency on %s via line %s already in TODO"
@@ -210,14 +222,6 @@ class DependencyDetector(object):
(dependency_sha1[:8], line_num,))
continue
- self.logger.debug(
- " New dependency %s -> %s via line %s (%s)" %
- (dependent_sha1[:8], dependency_sha1[:8], line_num,
- GitUtils.oneline(dependency)))
- self.dependencies[dependent_sha1][dependency_sha1] = {}
- self.notify_listeners('new_commit', dependency)
- self.notify_listeners('new_dependency',
- dependent, dependency, path, line_num)
if dependency_sha1 not in self.dependencies:
if self.options.recurse:
self.todo.append(dependency)