summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-11-11 19:52:36 -0600
committerSoren Hansen <soren.hansen@rackspace.com>2010-11-11 19:52:36 -0600
commit3b695e11da34247123ea919e71096e53393f227b (patch)
tree2b65c9b46dde23351df58eb08fe78eef38da0e7d /nova/utils.py
parent671b712a5ad9034fa89761018203cc7c1ea0449b (diff)
downloadnova-3b695e11da34247123ea919e71096e53393f227b.tar.gz
nova-3b695e11da34247123ea919e71096e53393f227b.tar.xz
nova-3b695e11da34247123ea919e71096e53393f227b.zip
Added a .mailmap that maps addresses in bzr to people's real, preferred
e-mail addresses. (I made a few guesses along the way, feel free to adjust according to what is actually the preferred e-mail) Added a couple of methods to nova.utils to parse said .mailmap and do the appropriate (though highly naïve) replacement. Apply mailmap replacement in changelog generation in setup.py. Add a unit test that checks everyone is properly listed in Authors. Add sleepsonthefloor to Authors. If anyone knows the real name, please add it.
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index e7892a212..b63237c10 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -173,6 +173,22 @@ def isotime(at=None):
def parse_isotime(timestr):
return datetime.datetime.strptime(timestr, TIME_FORMAT)
+def parse_mailmap(mailmap='.mailmap'):
+ mapping = {}
+ if os.path.exists(mailmap):
+ fp = open(mailmap, 'r')
+ for l in fp:
+ l = l.strip()
+ if not l.startswith('#') and ' ' in l:
+ canonical_email, alias = l.split(' ')
+ mapping[alias] = canonical_email
+ return mapping
+
+def str_dict_replace(s, mapping):
+ for s1, s2 in mapping.iteritems():
+ s = s.replace(s1, s2)
+ return s
+
class LazyPluggable(object):
"""A pluggable backend loaded lazily based on some value."""