You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/09/12 10:16:29 UTC

[kibble-scanners] branch master updated: add support for files changed as a list in each commit object

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble-scanners.git


The following commit(s) were added to refs/heads/master by this push:
     new 858733f  add support for files changed as a list in each commit object
858733f is described below

commit 858733f239c2a90346a3c055ed205eb9c50c6e50
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Sep 12 12:16:09 2018 +0200

    add support for files changed as a list in each commit object
---
 src/plugins/scanners/git-census.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/plugins/scanners/git-census.py b/src/plugins/scanners/git-census.py
index 3dc6fae..5ec0fe7 100644
--- a/src/plugins/scanners/git-census.py
+++ b/src/plugins/scanners/git-census.py
@@ -92,11 +92,14 @@ def scan(KibbleBit, source):
                 diff = m.group(7)
                 insert = 0
                 delete = 0
+                files_touched = set()
                 # Diffs
                 for l in re.finditer(u"(\d+)[ \t]+(\d+)[ \t]+([^\r\n]+)", diff, flags=re.MULTILINE):
                     insert += int(l.group(1))
                     delete += int(l.group(2))
                     filename = l.group(3)
+                    if filename:
+                        files_touched.update([filename])
                     if filename and len(filename) > 0 and (not filename in modificationDates or modificationDates[filename]['timestamp'] < ct):
                         modificationDates[filename] = {
                             'hash': ch,
@@ -171,7 +174,10 @@ def scan(KibbleBit, source):
                     if not gname in people[ae]['projects']:
                         people[ae]['projects'].append(gname)
 
-
+                # Make a list of changed files, max 1024
+                filelist = list(touched_files)
+                filelist = filelist[:1023]
+                
                 # ES commit documents
                 tsd = ts - (ts % 86400)
                 js = {
@@ -188,7 +194,8 @@ def scan(KibbleBit, source):
                     'author_email': ae,
                     'insertions': insert,
                     'deletions': delete,
-                    'vcs': 'git'
+                    'vcs': 'git',
+                    'files_changed': filelist
                 }
                 jsx = {
                     'id': ch,
@@ -204,7 +211,8 @@ def scan(KibbleBit, source):
                     'insertions': insert,
                     'deletions': delete,
                     'repository': rid, # This will always ever only be the last repo that had it!
-                    'vcs': 'git'
+                    'vcs': 'git',
+                    'files_changed': filelist
                 }
                 KibbleBit.append ( 'person', {
                     'upsert': True,