##// END OF EJS Templates
phabricator: pass ui into readurltoken instead of passing repo...
Pulkit Goyal -
r42626:500b64c5 default
parent child Browse files
Show More
@@ -183,24 +183,24 b' def urlencodenested(params):'
183 process(b'', params)
183 process(b'', params)
184 return util.urlreq.urlencode(flatparams)
184 return util.urlreq.urlencode(flatparams)
185
185
186 def readurltoken(repo):
186 def readurltoken(ui):
187 """return conduit url, token and make sure they exist
187 """return conduit url, token and make sure they exist
188
188
189 Currently read from [auth] config section. In the future, it might
189 Currently read from [auth] config section. In the future, it might
190 make sense to read from .arcconfig and .arcrc as well.
190 make sense to read from .arcconfig and .arcrc as well.
191 """
191 """
192 url = repo.ui.config(b'phabricator', b'url')
192 url = ui.config(b'phabricator', b'url')
193 if not url:
193 if not url:
194 raise error.Abort(_(b'config %s.%s is required')
194 raise error.Abort(_(b'config %s.%s is required')
195 % (b'phabricator', b'url'))
195 % (b'phabricator', b'url'))
196
196
197 res = httpconnectionmod.readauthforuri(repo.ui, url, util.url(url).user)
197 res = httpconnectionmod.readauthforuri(ui, url, util.url(url).user)
198 token = None
198 token = None
199
199
200 if res:
200 if res:
201 group, auth = res
201 group, auth = res
202
202
203 repo.ui.debug(b"using auth.%s.* for authentication\n" % group)
203 ui.debug(b"using auth.%s.* for authentication\n" % group)
204
204
205 token = auth.get(b'phabtoken')
205 token = auth.get(b'phabtoken')
206
206
@@ -212,7 +212,7 b' def readurltoken(repo):'
212
212
213 def callconduit(repo, name, params):
213 def callconduit(repo, name, params):
214 """call Conduit API, params is a dict. return json.loads result, or None"""
214 """call Conduit API, params is a dict. return json.loads result, or None"""
215 host, token = readurltoken(repo)
215 host, token = readurltoken(repo.ui)
216 url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo()
216 url, authinfo = util.url(b'/'.join([host, b'api', name])).authinfo()
217 repo.ui.debug(b'Conduit Call: %s %s\n' % (url, pycompat.byterepr(params)))
217 repo.ui.debug(b'Conduit Call: %s %s\n' % (url, pycompat.byterepr(params)))
218 params = params.copy()
218 params = params.copy()
@@ -653,7 +653,7 b' def phabsend(ui, repo, *revs, **opts):'
653 (b'parent', b'Parent ')])
653 (b'parent', b'Parent ')])
654
654
655 def _confirmbeforesend(repo, revs, oldmap):
655 def _confirmbeforesend(repo, revs, oldmap):
656 url, token = readurltoken(repo)
656 url, token = readurltoken(repo.ui)
657 ui = repo.ui
657 ui = repo.ui
658 for rev in revs:
658 for rev in revs:
659 ctx = repo[rev]
659 ctx = repo[rev]
General Comments 0
You need to be logged in to leave comments. Login now