Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys
  3.  
  4. users_map = {
  5.         "max" : {"name":  "Example User",
  6.                  "email": "user@example.com"},
  7.         "..." : "..."
  8.         }
  9.  
  10.  
  11.  
  12. commit_map = {
  13.         "5e5b21bfbb93899bb85241c1ff8cd4e756f28c87": "max",
  14.         "...":                                      "..."
  15. }
  16.  
  17.  
  18. if __name__ == "__main__":
  19.     if sys.argv[1] not in commit_map:
  20.         sys.exit(1)
  21.     if sys.argv[2] == "env":
  22.         user = users_map[commit_map[sys.argv[1]]]
  23.         print ('GIT_COMMITTER_NAME="%(name)s";\n'
  24.                'GIT_COMMITTER_EMAIL="%(email)s"\n;'
  25.                'GIT_AUTHOR_NAME="%(name)s";\n'
  26.                'GIT_AUTHOR_EMAIL="%(email)s"\n;') % user
  27.  
  28. # Then call:
  29. # $ git filter-branch -f --env-filter '
  30. #  if  ~/commit_map.py $GIT_COMMIT test ; then
  31. #    eval $(~/commit_map.py $GIT_COMMIT env)
  32. #  fi
  33. # ' -- --all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement