# HG changeset patch # User Matt Harbison # Date 1579298209 18000 # Node ID ff396501e8410ba455baabc4090fb1209c5af22b # Parent 59b3fe1e2021c2a6868c8939bea6ce6649c4baa1 phabricator: use .arcconfig for `phabricator.url` if not set locally This setting is also per repo; see the previous commit for details. The existing `conduit_uri` setting is the previous name of `phabricator.uri`[1] and while it could easily be queried before the latter for compatibility, the config in this repo has '/api' appended. That's already done in `callconduit()`, which would clearly end up giving the wrong result. It looks like the path of the URL is now ignored in user configs[2], so add the modern setting without it to this repo's .arcconfig. Sadly, we still need to have contributors configure `auth.hg.phabtoken` (and therefore `auth.hg.prefix` to link it to `phabricator.url`) in order to submit patches, but at least now it's localized to a single section. [1] https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/ [2] https://github.com/phacility/arcanist/blob/cc850163f30c4697e925df0d6212469679600a2c/scripts/arcanist.php#L271 Differential Revision: https://phab.mercurial-scm.org/D7935 diff -r 59b3fe1e2021 -r ff396501e841 .arcconfig --- a/.arcconfig Fri Jan 17 14:21:40 2020 -0500 +++ b/.arcconfig Fri Jan 17 16:56:49 2020 -0500 @@ -1,5 +1,6 @@ { "conduit_uri": "https://phab.mercurial-scm.org/api", + "phabricator.uri": "https://phab.mercurial-scm.org/", "repository.callsign": "HG", "arc.land.onto.default": "@", "base": "hg:.^" diff -r 59b3fe1e2021 -r ff396501e841 hgext/phabricator.py --- a/hgext/phabricator.py Fri Jan 17 14:21:40 2020 -0500 +++ b/hgext/phabricator.py Fri Jan 17 16:56:49 2020 -0500 @@ -178,11 +178,16 @@ except IOError: pass + cfg = util.sortdict() + if b"repository.callsign" in arcconfig: - ui.applyconfig( - {(b"phabricator", b"callsign"): arcconfig[b"repository.callsign"]}, - source=wdirvfs.join(b".arcconfig"), - ) + cfg[(b"phabricator", b"callsign")] = arcconfig[b"repository.callsign"] + + if b"phabricator.uri" in arcconfig: + cfg[(b"phabricator", b"url")] = arcconfig[b"phabricator.uri"] + + if cfg: + ui.applyconfig(cfg, source=wdirvfs.join(b".arcconfig")) return orig(ui, wdirvfs, hgvfs, requirements) or result # Load .hg/hgrc diff -r 59b3fe1e2021 -r ff396501e841 tests/test-phabricator.t --- a/tests/test-phabricator.t Fri Jan 17 14:21:40 2020 -0500 +++ b/tests/test-phabricator.t Fri Jan 17 16:56:49 2020 -0500 @@ -228,8 +228,8 @@ $ mv .hg/hgrc .hg/hgrc.bak $ hg config phabricator --debug read config from: */.hgrc (glob) - */.hgrc:*: phabricator.url=global (glob) $TESTTMP/repo/.arcconfig: phabricator.callsign=HG + $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/ But it doesn't override local config $ cat >> .hg/hgrc << EOF