Patchwork D7935: phabricator: use .arcconfig for `phabricator.url` if not set locally

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2020, 4:27 p.m.
Message ID <8f22ac9c8c1316d973913fa1b340f12f@localhost.localdomain>
Download mbox | patch
Permalink /patch/44550/
State Not Applicable
Headers show

Comments

phabricator - Jan. 21, 2020, 4:27 p.m.
Closed by commit rHGff396501e841: phabricator: use .arcconfig for `phabricator.url` if not set locally (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7935?vs=19439&id=19486

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7935/new/

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

AFFECTED FILES
  .arcconfig
  hgext/phabricator.py
  tests/test-phabricator.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t
--- a/tests/test-phabricator.t
+++ b/tests/test-phabricator.t
@@ -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
diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -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 --git a/.arcconfig b/.arcconfig
--- a/.arcconfig
+++ b/.arcconfig
@@ -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:.^"