From 466c2c6b34a6a70b4f367c029b072b65b3bbb08e Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 11 Nov 2012 18:49:01 +0100 Subject: Make aliases more flexible, add to aliases --- git-identity-map.py | 38 +++++++++++++++++++++++++++++++++----- 1 file 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 -- cgit v1.2.3-65-gdbad