summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2012-03-25 01:46:20 +0100
committerSebastian Pipping <sebastian@pipping.org>2012-03-25 01:46:20 +0100
commit70c164c4cde357a6788c6f368685c16a46600a97 (patch)
tree8f764f3fd8bb280144b05c94068108ca3725dfa6
parentAdd script on stats that are asked upon registration at LinuxTag Berlin (diff)
downloaduserinfo-scripts-70c164c4cde357a6788c6f368685c16a46600a97.tar.gz
userinfo-scripts-70c164c4cde357a6788c6f368685c16a46600a97.tar.bz2
userinfo-scripts-70c164c4cde357a6788c6f368685c16a46600a97.zip
Add script to generate Git identity maps (for git-svn or svn2git)
-rwxr-xr-xgit-identity-map.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/git-identity-map.py b/git-identity-map.py
new file mode 100755
index 0000000..c83a744
--- /dev/null
+++ b/git-identity-map.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Written by Sebastian Pipping <sebastian@pipping.org>
+# Licensed under GPL v2 or later
+
+from __future__ import print_function
+import xml.etree.ElementTree as ET # Python 2.5
+import sys
+
+
+def main(args):
+ if len(args) != 2:
+ print('USAGE: %s GENTOO/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml' % args[0])
+ return 1
+
+ try:
+ userlist = ET.parse(args[1])
+ except IOError as e:
+ print(str(e), file=sys.stderr)
+ return 1
+
+ for user in userlist.findall('user'):
+ nick = user.attrib['username']
+ location = user.find('location')
+ realname = user.find('realname').attrib['fullname'].strip()
+
+ line = '%s = %s <%s@gentoo.org>' % (nick, realname, nick)
+ print(line.encode('utf-8'))
+
+ return 0
+
+
+if __name__ == '__main__':
+ ret = main(sys.argv)
+ sys.exit(ret)