# HG changeset patch # User Sean Farley # Date 1395678058 18000 # Node ID 367e65989b41394e898badcbb0fb7747cc27d0cd # Parent e1619c051788692046f83b068fb063e6cef7a133 maps: add custom __setitem__ to author map We add a custom __setitem__ that will encapsulate the meta.caseignoreauthor logic. diff --git a/hgsubversion/maps.py b/hgsubversion/maps.py --- 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