[Commented On] D8524: phabricator: add .arcconfig to help messages and comments (issue6331)

sfink (Steve Fink) phabricator at mercurial-scm.org
Fri Aug 28 20:15:59 UTC 2020


sfink added a comment.
sfink updated this revision to Diff 22485.


  It gets a little messy when uploading partial patches to code that I am patching

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8524?vs=22484&id=22485

BRANCH
  default

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

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -41,6 +41,9 @@
 
     # API token. Get it from https://$HOST/conduit/login/
     example.phabtoken = cli-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+phabricator.url and callsign will fallback to values from checkout's .arcconfig
+if available.
 """
 
 from __future__ import absolute_import
@@ -169,7 +172,6 @@
 def _loadhgrc(orig, ui, wdirvfs, hgvfs, requirements):
     """Load ``.arcconfig`` content into a ui instance on repository open.
     """
-    result = False
     arcconfig = {}
 
     try:
@@ -182,8 +184,6 @@
             else x,
             pycompat.json_loads(rawparams),
         )
-
-        result = True
     except ValueError:
         ui.warn(_(b"invalid JSON in %s\n") % wdirvfs.join(b".arcconfig"))
     except IOError:
@@ -200,7 +200,7 @@
     if cfg:
         ui.applyconfig(cfg, source=wdirvfs.join(b".arcconfig"))
 
-    return orig(ui, wdirvfs, hgvfs, requirements) or result  # Load .hg/hgrc
+    return orig(ui, wdirvfs, hgvfs, requirements) or bool(cfg)  # Load .hg/hgrc
 
 
 def vcrcommand(name, flags, spec, helpcategory=None, optionalrepo=False):
@@ -328,13 +328,18 @@
 def readurltoken(ui):
     """return conduit url, token and make sure they exist
 
-    Currently read from [auth] config section. In the future, it might
-    make sense to read from .arcconfig and .arcrc as well.
+    Read token from [auth] config section. Read url from [phabricator] config
+    section or repo's .arcconfig. In the future, it might make sense to read
+    tokens from ~/.arcrc as well.
     """
     url = ui.config(b'phabricator', b'url')
     if not url:
         raise error.Abort(
-            _(b'config %s.%s is required') % (b'phabricator', b'url')
+            _(
+                b'unable to read phabricator uri from from config %s.%s or %s '
+                b'file in repo'
+            )
+            % (b'phabricator', b'url', b'.arcconfig')
         )
 
     res = httpconnectionmod.readauthforuri(ui, url, util.url(url).user)



To: sfink, mharbison72, marmoute
Cc: marmoute, Kwan, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200828/ffd47920/attachment-0001.html>


More information about the Mercurial-patches mailing list