Show More
@@ -165,38 +165,6 b' def urlencodenested(params):' | |||
|
165 | 165 | process(b'', params) |
|
166 | 166 | return util.urlreq.urlencode(flatparams) |
|
167 | 167 | |
|
168 | printed_token_warning = False | |
|
169 | ||
|
170 | def readlegacytoken(repo, url): | |
|
171 | """Transitional support for old phabricator tokens. | |
|
172 | ||
|
173 | Remove before the 4.7 release. | |
|
174 | """ | |
|
175 | groups = {} | |
|
176 | for key, val in repo.ui.configitems(b'phabricator.auth'): | |
|
177 | if b'.' not in key: | |
|
178 | repo.ui.warn(_(b"ignoring invalid [phabricator.auth] key '%s'\n") | |
|
179 | % key) | |
|
180 | continue | |
|
181 | group, setting = key.rsplit(b'.', 1) | |
|
182 | groups.setdefault(group, {})[setting] = val | |
|
183 | ||
|
184 | token = None | |
|
185 | for group, auth in groups.iteritems(): | |
|
186 | if url != auth.get(b'url'): | |
|
187 | continue | |
|
188 | token = auth.get(b'token') | |
|
189 | if token: | |
|
190 | break | |
|
191 | ||
|
192 | global printed_token_warning | |
|
193 | ||
|
194 | if token and not printed_token_warning: | |
|
195 | printed_token_warning = True | |
|
196 | repo.ui.warn(_(b'phabricator.auth.token is deprecated - please ' | |
|
197 | b'migrate to auth.phabtoken.\n')) | |
|
198 | return token | |
|
199 | ||
|
200 | 168 | def readurltoken(repo): |
|
201 | 169 | """return conduit url, token and make sure they exist |
|
202 | 170 | |
@@ -219,10 +187,8 b' def readurltoken(repo):' | |||
|
219 | 187 | token = auth.get(b'phabtoken') |
|
220 | 188 | |
|
221 | 189 | if not token: |
|
222 | token = readlegacytoken(repo, url) | |
|
223 | if not token: | |
|
224 | raise error.Abort(_(b'Can\'t find conduit token associated to %s') | |
|
225 | % (url,)) | |
|
190 | raise error.Abort(_(b'Can\'t find conduit token associated to %s') | |
|
191 | % (url,)) | |
|
226 | 192 | |
|
227 | 193 | return url, token |
|
228 | 194 |
General Comments 0
You need to be logged in to leave comments.
Login now