comparison maps.py @ 329:235022089da6

merge with stable
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sat, 09 May 2009 12:36:17 +0200
parents 05cd4a5138bf
children
comparison
equal deleted inserted replaced
328:48ec2d62dc29 329:235022089da6
4 from mercurial import util as hgutil 4 from mercurial import util as hgutil
5 5
6 class AuthorMap(dict): 6 class AuthorMap(dict):
7 '''A mapping from Subversion-style authors to Mercurial-style 7 '''A mapping from Subversion-style authors to Mercurial-style
8 authors, and back. The data is stored persistently on disk. 8 authors, and back. The data is stored persistently on disk.
9 9
10 If the 'hgsubversion.defaultauthors' configuration option is set to false, 10 If the 'hgsubversion.defaultauthors' configuration option is set to false,
11 attempting to obtain an unknown author will fail with an Abort. 11 attempting to obtain an unknown author will fail with an Abort.
12 ''' 12 '''
13 13
14 def __init__(self, ui, path, defaulthost=None): 14 def __init__(self, ui, path, defaulthost=None):
15 '''Initialise a new AuthorMap. 15 '''Initialise a new AuthorMap.
16 16
17 The ui argument is used to print diagnostic messages. 17 The ui argument is used to print diagnostic messages.
18 18
19 The path argument is the location of the backing store, 19 The path argument is the location of the backing store,
20 typically .hg/authormap. 20 typically .hg/authormap.
21 ''' 21 '''
22 self.ui = ui 22 self.ui = ui
23 self.path = path 23 self.path = path
68 In such cases, a new value is generated and added to the dictionary 68 In such cases, a new value is generated and added to the dictionary
69 as well as the backing store. ''' 69 as well as the backing store. '''
70 if author in self: 70 if author in self:
71 result = self.super.__getitem__(author) 71 result = self.super.__getitem__(author)
72 elif self.ui.configbool('hgsubversion', 'defaultauthors', True): 72 elif self.ui.configbool('hgsubversion', 'defaultauthors', True):
73 # TODO: should we treat missing authors specially?
74 self[author] = result = '%s%s' % (author, self.defaulthost) 73 self[author] = result = '%s%s' % (author, self.defaulthost)
75 self.ui.warn('Substituting author "%s" for default "%s"\n' 74 self.ui.note('Substituting author "%s" for default "%s"\n'
76 % (author, result)) 75 % (author, result))
77 else: 76 else:
78 raise hgutil.Abort('Author %s has no entry in the author map!' 77 raise hgutil.Abort('Author %s has no entry in the author map!'
79 % author) 78 % author)
80 self.ui.debug('Mapping author "%s" to "%s"\n' % (author, result)) 79 self.ui.debug('Mapping author "%s" to "%s"\n' % (author, result))