D5299: phabricator: fallback reading arcanist config files

Kwan (Ian Moody) phabricator at mercurial-scm.org
Sun May 12 07:04:20 EDT 2019


Kwan added inline comments.

INLINE COMMENTS

> philpep wrote in phabricator.py:175
> I'd be nice to cache the result of `readarcconfig` but I don't known how to implement this, any suggestion ?

Looks like annotating it with `@util.cachefunc` is enough?

> Kwan wrote in phabricator.py:217-222
> Something I realised with some testing is that this requires both .arcconfig and .arcrc, one can't rely on the repo's .arcconfig for the repo settings while using .hg/hgrc for the auth settings (or use hgrc for phab url with .arcrc for auth).  Maybe it could instead do the following:
> 
>   hgrcurl = repo.ui.config(b'phabricator', b'url')
>   arcurl, arctoken, __ = readarcconfig(repo)
>   url = hgrcurl or arcurl
>   if not url:
>       [etc...]
>   
>   res = [etc...]
>   hgrctoken = None
>   
>   if res:
>       [etc...]
>       hgrctoken = auth.get(b'token')
>   token = hgrctoken or arctoken
>   if not token:
>       [etc...]
> 
> That way any mix of settings in hgrc or .arcconfig/.arcrc would work, with hgrc having precedence.

Although, this wouldn't work with changing phab instances in hgrc, and using .arcrc for the token, since `readarcconfig` would return the  token for the original URL.  An alternative would be having `readarcconfig` return a dict mapping hosts to tokens (with '/api/' stripped from the hosts), and then `readurltoken` does `token = hgrctoken or arctokens.get(url)`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5299

To: philpep, #hg-reviewers
Cc: Kwan, mharbison72, mercurial-devel


More information about the Mercurial-devel mailing list