Created
November 22, 2019 19:24
Revisions
-
caleb15 created this gist
Nov 22, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import re # run ./git-most.sh > most.txt before this script # adjust whitelist var if you only want to see changes to a certain filetype/file/path most_changed_paths = {} whitelist = '' # '.yml' with open('most.txt') as f: for line in f.readlines(): split_line = line.split('\t') if len(split_line) == 1: continue # ignore malformed lines num = int(split_line[0]) path = split_line[1].strip() if whitelist: if whitelist not in path: continue match = re.fullmatch(r'(roles/[^/]+)/.*', path) if match: roleDir = match.group(1) if roleDir in most_changed_paths: most_changed_paths[roleDir] += num else: most_changed_paths[roleDir] = num sorted_most_changed_paths = sorted(most_changed_paths.items(), key=lambda kv: kv[1]) sorted_most_changed_paths.reverse() for path in sorted_most_changed_paths: print(path)