Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- users_map = {
- "max" : {"name": "Example User",
- "email": "user@example.com"},
- "..." : "..."
- }
- commit_map = {
- "5e5b21bfbb93899bb85241c1ff8cd4e756f28c87": "max",
- "...": "..."
- }
- if __name__ == "__main__":
- if sys.argv[1] not in commit_map:
- sys.exit(1)
- if sys.argv[2] == "env":
- user = users_map[commit_map[sys.argv[1]]]
- print ('GIT_COMMITTER_NAME="%(name)s";\n'
- 'GIT_COMMITTER_EMAIL="%(email)s"\n;'
- 'GIT_AUTHOR_NAME="%(name)s";\n'
- 'GIT_AUTHOR_EMAIL="%(email)s"\n;') % user
- # Then call:
- # $ git filter-branch -f --env-filter '
- # if ~/commit_map.py $GIT_COMMIT test ; then
- # eval $(~/commit_map.py $GIT_COMMIT env)
- # fi
- # ' -- --all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement