summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2012-11-11 18:49:01 +0100
committerSebastian Pipping <sebastian@pipping.org>2012-11-11 18:51:00 +0100
commit466c2c6b34a6a70b4f367c029b072b65b3bbb08e (patch)
treea407077699617aa7e27f070372e164a45f543b25
parentSimplify produce_line() (diff)
downloaduserinfo-scripts-466c2c6b34a6a70b4f367c029b072b65b3bbb08e.tar.gz
userinfo-scripts-466c2c6b34a6a70b4f367c029b072b65b3bbb08e.tar.bz2
userinfo-scripts-466c2c6b34a6a70b4f367c029b072b65b3bbb08e.zip
Make aliases more flexible, add to aliases
-rwxr-xr-xgit-identity-map.py38
1 files changed, 33 insertions, 5 deletions
diff --git a/git-identity-map.py b/git-identity-map.py
index 05dad60..c919a24 100755
--- a/git-identity-map.py
+++ b/git-identity-map.py
@@ -8,11 +8,31 @@ import xml.etree.ElementTree as ET # Python 2.5
import sys
-def produce_line(gentoo_nick, realname):
- line = '%s = %s <%s@gentoo.org>' % (gentoo_nick, realname, gentoo_nick)
+_PAST_GENTOO_ACCOUNT, _CHAT_OR_LOCAL_ONLY = range(2)
+
+
+_past_nicknames_for = {
+ 'chithanh': (
+ ('chithead', _CHAT_OR_LOCAL_ONLY),
+ ),
+ 'fauli': (
+ ('opfer', _PAST_GENTOO_ACCOUNT),
+ ),
+ 'stkn': (
+ ('aura', _CHAT_OR_LOCAL_ONLY),
+ ),
+}
+
+
+def _produce_line(svn_nick, realname, address):
+ line = '%s = %s <%s>' % (svn_nick, realname, address)
print(line.encode('utf-8'))
+def _gentoo_address(nick):
+ return '%s@gentoo.org' % nick
+
+
def main(args):
if len(args) != 2:
print('USAGE: %s GENTOO/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml' % args[0])
@@ -29,10 +49,18 @@ def main(args):
location = user.find('location')
realname = user.find('realname').attrib['fullname'].strip()
- produce_line(svn_nick, realname)
+ _produce_line(svn_nick, realname, _gentoo_address(svn_nick))
+
+ past_nicknames = _past_nicknames_for.get(svn_nick, [])
+ for alias, kind in past_nicknames:
+ if kind == _PAST_GENTOO_ACCOUNT:
+ gentoo_nick=alias
+ elif kind == _CHAT_OR_LOCAL_ONLY:
+ gentoo_nick=svn_nick
+ else:
+ assert False, 'Invalid kind %s' % str(kind)
+ _produce_line(alias, realname, _gentoo_address(gentoo_nick))
- if svn_nick == 'fauli':
- produce_line('opfer', realname)
return 0