summaryrefslogtreecommitdiffstats
path: root/roles/git/hooks/files/post-receive-fedmsg
diff options
context:
space:
mode:
Diffstat (limited to 'roles/git/hooks/files/post-receive-fedmsg')
-rwxr-xr-xroles/git/hooks/files/post-receive-fedmsg18
1 files changed, 14 insertions, 4 deletions
diff --git a/roles/git/hooks/files/post-receive-fedmsg b/roles/git/hooks/files/post-receive-fedmsg
index 782accde6..3545be2e3 100755
--- a/roles/git/hooks/files/post-receive-fedmsg
+++ b/roles/git/hooks/files/post-receive-fedmsg
@@ -53,10 +53,20 @@ def build_stats(commit):
for diff in diffs:
for patch in diff:
- path = patch.new_file_path
- files[path]['additions'] += patch.additions
- files[path]['deletions'] += patch.deletions
- files[path]['lines'] += patch.additions + patch.deletions
+ if hasattr(patch, 'new_file_path'):
+ path = patch.new_file_path
+ else:
+ path = patch.delta.new_file.path
+
+ if hasattr(patch, 'additions'):
+ files[path]['additions'] += patch.additions
+ files[path]['deletions'] += patch.deletions
+ files[path]['lines'] += patch.additions + patch.deletions
+ else:
+ files[path]['additions'] += patch.line_stats[1]
+ files[path]['deletions'] += patch.line_stats[2]
+ files[path]['lines'] += patch.line_stats[1] \
+ + patch.line_stats[2]
total = defaultdict(int)
for name, stats in files.items():