changeset 1379:367e65989b41

maps: add custom __setitem__ to author map We add a custom __setitem__ that will encapsulate the meta.caseignoreauthor logic.
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:58 -0500
parents e1619c051788
children 332ad9ea579b
files hgsubversion/maps.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -88,6 +88,14 @@ class AuthorMap(dict):
         if writing:
             writing.close()
 
+    def __setitem__(self, key, value):
+        '''Similar to dict.__setitem__, except we check caseignoreauthors to
+        use lowercase string or not
+        '''
+        if self.meta.caseignoreauthors:
+            key = key.lower()
+        super(AuthorMap, self).__setitem__(key, value)
+
     def __getitem__(self, author):
         ''' Similar to dict.__getitem__, except in case of an unknown author.
         In such cases, a new value is generated and added to the dictionary