contrib/phabricator.py
changeset 36788 b434965f984e
parent 36787 4397909f82d3
child 36817 98cbfbbe33bb
--- a/contrib/phabricator.py	Sat Jan 20 02:41:10 2018 -0700
+++ b/contrib/phabricator.py	Sun Mar 04 11:46:03 2018 -0500
@@ -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 = repo.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