From 0faacb6d0d02387f81be3ab07c4022a49ce10372 Mon Sep 17 00:00:00 2001 From: konstantin-shatalov <53061844+konstantin-shatalov@users.noreply.github.com> Date: Tue, 14 May 2024 18:05:22 -0400 Subject: [PATCH] Added support for number of lines changed for git logs (#557) Co-authored-by: Kelly Brazil Co-authored-by: kshatalov --- jc/parsers/git_log.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/jc/parsers/git_log.py b/jc/parsers/git_log.py index e1f0ea49..69c84655 100644 --- a/jc/parsers/git_log.py +++ b/jc/parsers/git_log.py @@ -320,7 +320,20 @@ def parse( if line.startswith(' ') and 'changed, ' not in line: # this is a file name file_name = line.split('|')[0].strip() - file_list.append(file_name) + file_stats = line.split('|')[1].strip() + lines_changed_str = file_stats.split(' ') + lines_changed_count_str = lines_changed_str[0].strip() + lines_changed = 0 + try: + lines_changed = int(lines_changed_count_str) + except: + #nothing to do + pass + + file = {} + file["name"] = file_name + file["lines_changed"] = lines_changed + file_list.append(file) continue if line.startswith(' ') and 'changed, ' in line: