aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@google.com>2012-10-14 15:56:29 -0700
committerBrian Harring <ferringb@google.com>2012-10-16 13:28:49 -0700
commit901721097cd3cf4a7c23a0e1d15767f5defe727a (patch)
tree1bdb14a1cfff83b949ff481885cd25f620d692c5 /create-mailmap.py
parentOngoing mangling (diff)
downloadgit-conversion-tools-901721097cd3cf4a7c23a0e1d15767f5defe727a.tar.gz
git-conversion-tools-901721097cd3cf4a7c23a0e1d15767f5defe727a.tar.bz2
git-conversion-tools-901721097cd3cf4a7c23a0e1d15767f5defe727a.zip
update gitignore for intermediate/resultant content
Diffstat (limited to 'create-mailmap.py')
-rwxr-xr-xcreate-mailmap.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/create-mailmap.py b/create-mailmap.py
new file mode 100755
index 0000000..085d84f
--- /dev/null
+++ b/create-mailmap.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+from xml.etree import ElementTree as etree
+
+def main(source):
+ root = etree.parse(source).getroot()
+ for user in root.findall('user'):
+ fullname = user.findall('realname')[0].get('fullname')
+ # Compute email ourselves...
+ username = user.get('username')
+ assert username
+ email = '%s@gentoo.org' % username
+ yield username, (fullname, email)
+ # Handle aliases...
+ for alias in user.findall('alias'):
+ yield alias.text, (fullname, email)
+
+
+if __name__ == '__main__':
+ import sys
+ if len(sys.argv) != 2:
+ sys.stderr.write("path to userinfo.xml required\n")
+ sys.exit(1)
+
+ mailmap = dict(main(open(sys.argv[1], 'rb')))
+ sys.stdout.write("mailmap=%r\n" % (mailmap,))
+ sys.exit(0)