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)