Patchwork D2703: phabricator: follow-up phab auth improvements with backwards compat mode

login
register
mail settings
Submitter phabricator
Date March 8, 2018, 7:19 p.m.
Message ID <7065ac42aecb4c437fc1508d29e0985b@localhost.localdomain>
Download mbox | patch
Permalink /patch/29130/
State Not Applicable
Headers show

Comments

phabricator - March 8, 2018, 7:19 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd289ea66a356: phabricator: follow-up phab auth improvements with backwards compat mode (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2703?vs=6677&id=6731

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

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