aboutsummaryrefslogtreecommitdiffstats
path: root/git_deps/detector.py
diff options
context:
space:
mode:
authorAdam Spiers <git@adamspiers.org>2016-06-29 19:22:23 +0100
committerAdam Spiers <git@adamspiers.org>2018-05-15 13:42:16 +0100
commit7c462c7184986e16aea1f01726a8cadcf0900168 (patch)
treec466b71aa0c94601025c88f076a70e610191579a /git_deps/detector.py
parent2b6428a0e25e4ee54d213adc78d8c39077f1405d (diff)
downloadgit-deps-7c462c7184986e16aea1f01726a8cadcf0900168.tar.gz
move oneline() to gitutils.py
It has nothing to do with DependencyDetector, and this will let us reuse it from git-explode too.
Diffstat (limited to 'git_deps/detector.py')
-rw-r--r--git_deps/detector.py11
1 files changed, 5 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: