Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. # git log --stat --name-only --pretty='hash:%H' | python p.py
  2.  
  3. import sys
  4. from collections import defaultdict
  5. import json
  6.  
  7. cur_hash = None
  8. mapping = defaultdict(list)
  9.  
  10. for line in sys.stdin:
  11.  
  12. line = line.strip()
  13.  
  14. if not line:
  15. continue
  16.  
  17. if line.startswith("hash:"):
  18. cur_hash = line.split(":")[-1]
  19. continue
  20.  
  21. mapping[line].append(cur_hash)
  22.  
  23. json.dump(mapping, sys.stdout, indent=4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement