Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement