Patchwork phabricator: drop support for the legacy phabricator.auth.token config

login
register
mail settings
Submitter Matt Harbison
Date Oct. 12, 2018, 3 a.m.
Message ID <fc6a549e7896dab7402e.1539313217@Envy>
Download mbox | patch
Permalink /patch/35646/
State Accepted
Headers show

Comments

Matt Harbison - Oct. 12, 2018, 3 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1539309077 14400
#      Thu Oct 11 21:51:17 2018 -0400
# Node ID fc6a549e7896dab7402e2110199309fa0b518558
# Parent  1cbc0a3024bc7b949132fbe2cbb7b77ae5922e5e
phabricator: drop support for the legacy phabricator.auth.token config

The test for this broke in dc82ad1b7f77 when statistics started being tracked.
It wasn't noticed because none of the bots have the vcr module installed.  It
looks like the custom_patches argument should patch in the custom
httpconnection, and I can't figure out what is going on.
Yuya Nishihara - Oct. 12, 2018, 5:31 a.m.
On Thu, 11 Oct 2018 23:00:17 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1539309077 14400
> #      Thu Oct 11 21:51:17 2018 -0400
> # Node ID fc6a549e7896dab7402e2110199309fa0b518558
> # Parent  1cbc0a3024bc7b949132fbe2cbb7b77ae5922e5e
> phabricator: drop support for the legacy phabricator.auth.token config

Flagged as (BC) and queued, thanks.

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -165,38 +165,6 @@  def urlencodenested(params):
     process(b'', params)
     return util.urlreq.urlencode(flatparams)
 
-printed_token_warning = False
-
-def readlegacytoken(repo, url):
-    """Transitional support for old phabricator tokens.
-
-    Remove before the 4.7 release.
-    """
-    groups = {}
-    for key, val in repo.ui.configitems(b'phabricator.auth'):
-        if b'.' not in key:
-            repo.ui.warn(_(b"ignoring invalid [phabricator.auth] key '%s'\n")
-                         % key)
-            continue
-        group, setting = key.rsplit(b'.', 1)
-        groups.setdefault(group, {})[setting] = val
-
-    token = None
-    for group, auth in groups.iteritems():
-        if url != auth.get(b'url'):
-            continue
-        token = auth.get(b'token')
-        if token:
-            break
-
-    global printed_token_warning
-
-    if token and not printed_token_warning:
-        printed_token_warning = True
-        repo.ui.warn(_(b'phabricator.auth.token is deprecated - please '
-                       b'migrate to auth.phabtoken.\n'))
-    return token
-
 def readurltoken(repo):
     """return conduit url, token and make sure they exist
 
@@ -219,10 +187,8 @@  def readurltoken(repo):
         token = auth.get(b'phabtoken')
 
     if not token:
-        token = readlegacytoken(repo, url)
-        if not token:
-            raise error.Abort(_(b'Can\'t find conduit token associated to %s')
-                              % (url,))
+        raise error.Abort(_(b'Can\'t find conduit token associated to %s')
+                            % (url,))
 
     return url, token