D2703: phabricator: follow-up phab auth improvements with backwards compat mode
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Tue Mar 6 19:00:53 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
We'll rip this out before we ship 4.6, but this gives people a window
to migrate.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2703
AFFECTED FILES
contrib/phabricator.py
CHANGE DETAILS
diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -99,6 +99,17 @@
process('', params)
return util.urlreq.urlencode(flatparams)
+def readlegacytoken(repo):
+ """Transitional support for old phabricator tokens.
+
+ Remove before the 4.6 release.
+ """
+ token = ui.config('phabricator', 'token')
+ if token:
+ repo.ui.warn(_('phabricator.token is deprecated - please '
+ 'migrate to the phabricator.auth section.\n'))
+ return token
+
def readurltoken(repo):
"""return conduit url, token and make sure they exist
@@ -128,8 +139,10 @@
break
if not token:
- raise error.Abort(_('Can\'t find conduit token associated to %s')
- % (url,))
+ token = readlegacytoken(repo)
+ if not token:
+ raise error.Abort(_('Can\'t find conduit token associated to %s')
+ % (url,))
return url, token
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list