aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps
diff options
context:
space:
mode:
Diffstat (limited to 'git_deps')
-rw-r--r--git_deps/detector.py11
-rw-r--r--git_deps/gitutils.py4
2 files changed, 9 insertions, 6 deletions
diff --git a/git_deps/detector.py b/git_deps/detector.py
index 4de1282..e64d17f 100644
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -4,6 +4,7 @@ import subprocess
import pygit2
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
@@ -168,7 +169,7 @@ class DependencyDetector(object):
dependent_sha1 = dependent.hex
if dependent_sha1 not in self.dependencies:
self.logger.debug(' New dependent: %s (%s)' %
- (dependent_sha1[:8], self.oneline(dependent)))
+ (dependent_sha1[:8], GitUtils.oneline(dependent)))
self.dependencies[dependent_sha1] = {}
self.notify_listeners('new_dependent', dependent)
@@ -188,7 +189,7 @@ class DependencyDetector(object):
self.logger.debug(
' Excluding dependency %s from line %s (%s)' %
(dependency_sha1[:8], line_num,
- self.oneline(dependency)))
+ GitUtils.oneline(dependency)))
continue
if dependency_sha1 not in self.dependencies[dependent_sha1]:
@@ -206,7 +207,8 @@ class DependencyDetector(object):
self.logger.debug(
' New dependency %s via line %s (%s)' %
- (dependency_sha1[:8], line_num, self.oneline(dependency)))
+ (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',
@@ -248,9 +250,6 @@ class DependencyDetector(object):
self.logger.debug(diff_format %
(rev, ln, line.origin, line.content.rstrip()))
- def oneline(self, commit):
- return commit.message.split('\n', 1)[0]
-
def is_excluded(self, commit):
if self.options.exclude_commits is not None:
for exclude in self.options.exclude_commits:
diff --git a/git_deps/gitutils.py b/git_deps/gitutils.py
index f5d8281..ce80ad5 100644
--- a/git_deps/gitutils.py
+++ b/git_deps/gitutils.py
@@ -49,6 +49,10 @@ class GitUtils(object):
return out
@classmethod
+ def oneline(cls, commit):
+ return commit.message.split('\n', 1)[0]
+
+ @classmethod
def refs_to(cls, sha1, repo):
"""Returns all refs pointing to the given SHA1."""
matching = []