-
-
Save jhjaggars/976a9c84f440b35ff0231820228902d1 to your computer and use it in GitHub Desktop.
This file contains 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 characters
# git log --stat --name-only --pretty='hash:%H' | python p.py | |
import sys | |
from collections import defaultdict | |
import json | |
cur_hash = None | |
mapping = defaultdict(list) | |
for line in sys.stdin: | |
line = line.strip() | |
if not line: | |
continue | |
if line.startswith("hash:"): | |
cur_hash = line.split(":")[-1] | |
continue | |
mapping[line].append(cur_hash) | |
json.dump(mapping, sys.stdout, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment