Patchwork D2754: phabricator: print deprecation warning only once

login
register
mail settings
Submitter phabricator
Date March 9, 2018, 3:10 p.m.
Message ID <differential-rev-PHID-DREV-ytzlz62wr2fdmhwz4sbg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29176/
State Superseded
Headers show

Comments

phabricator - March 9, 2018, 3:10 p.m.
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -99,13 +99,17 @@ 
     process('', params)
     return util.urlreq.urlencode(flatparams)
 
+printed_token_warning = False
+
 def readlegacytoken(repo):
     """Transitional support for old phabricator tokens.
 
     Remove before the 4.6 release.
     """
+    global printed_token_warning
     token = repo.ui.config('phabricator', 'token')
-    if token:
+    if token and not printed_token_warning:
+        printed_token_warning = True
         repo.ui.warn(_('phabricator.token is deprecated - please '
                        'migrate to the phabricator.auth section.\n'))
     return token