Mercurial > hg
comparison mercurial/url.py @ 13370:d13a533a0b11
url: use rsplit to split [auth] keys
None of the auth section subkeys include a period, so it makes zero
sense to not split from the end. By using rsplit() users can use
the hostname as group keys.
author | Steve Borho <steve@borho.org> |
---|---|
date | Sat, 12 Feb 2011 21:53:27 -0600 |
parents | 4e92ad05fe18 |
children | c691cfdc6b4d |
comparison
equal
deleted
inserted
replaced
13368:d4ab9486e514 | 13370:d13a533a0b11 |
---|---|
153 config = dict() | 153 config = dict() |
154 for key, val in self.ui.configitems('auth'): | 154 for key, val in self.ui.configitems('auth'): |
155 if '.' not in key: | 155 if '.' not in key: |
156 self.ui.warn(_("ignoring invalid [auth] key '%s'\n") % key) | 156 self.ui.warn(_("ignoring invalid [auth] key '%s'\n") % key) |
157 continue | 157 continue |
158 group, setting = key.split('.', 1) | 158 group, setting = key.rsplit('.', 1) |
159 gdict = config.setdefault(group, dict()) | 159 gdict = config.setdefault(group, dict()) |
160 if setting in ('username', 'cert', 'key'): | 160 if setting in ('username', 'cert', 'key'): |
161 val = util.expandpath(val) | 161 val = util.expandpath(val) |
162 gdict[setting] = val | 162 gdict[setting] = val |
163 | 163 |