Patchwork [STABLE] deprecation: gate deprecation warning behind devel configuration

login
register
mail settings
Submitter Pierre-Yves David
Date May 5, 2016, 2:36 p.m.
Message ID <332d908d7b8a07ed3885.1462459013@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/14922/
State Accepted
Headers show

Comments

Pierre-Yves David - May 5, 2016, 2:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1462458571 -7200
#      Thu May 05 16:29:31 2016 +0200
# Branch stable
# Node ID 332d908d7b8a07ed3885fef9ffcc95ac99597e5f
# Parent  61463b8fcef871ff3efff53945df4671c71c4e31
# EXP-Topic deprecwarn
deprecation: gate deprecation warning behind devel configuration

Regular users are not supposed to be exposed to the API deprecation warnings.
We now only issue them when the developper warnings are enabled.
Matt Mackall - May 5, 2016, 8:04 p.m.
On Thu, 2016-05-05 at 16:36 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1462458571 -7200
> #      Thu May 05 16:29:31 2016 +0200
> # Branch stable
> # Node ID 332d908d7b8a07ed3885fef9ffcc95ac99597e5f
> # Parent  61463b8fcef871ff3efff53945df4671c71c4e31
> # EXP-Topic deprecwarn
> deprecation: gate deprecation warning behind devel configuration
> 
> Regular users are not supposed to be exposed to the API deprecation warnings.
>
> We now only issue them when the developper warnings are enabled.

Queued for stable with much cursing.

-- 
Mathematics is the supreme nostalgia of our time.
Pierre-Yves David - May 12, 2016, 10:54 p.m.
On 05/05/2016 10:04 PM, Matt Mackall wrote:
> On Thu, 2016-05-05 at 16:36 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>> # Date 1462458571 -7200
>> #      Thu May 05 16:29:31 2016 +0200
>> # Branch stable
>> # Node ID 332d908d7b8a07ed3885fef9ffcc95ac99597e5f
>> # Parent  61463b8fcef871ff3efff53945df4671c71c4e31
>> # EXP-Topic deprecwarn
>> deprecation: gate deprecation warning behind devel configuration
>>
>> Regular users are not supposed to be exposed to the API deprecation warnings.
>>
>> We now only issue them when the developper warnings are enabled.
> Queued for stable with much cursing.

Unfortunately, the issue is even more problematic that first though.

At extension setup time the MQ extension is iterating over -all- 
commands to add them a --mq flag, checking the 'norepo' attribute in the 
process. This trigger the warning for all commands using the old style, 
creating, for some users, a wall of warning for each mercurial invocation.

With this changeset, the issue is fixed on the stable branch, but 3.8.1 
does not have it. I believe we should release a 3.8.2 with this fix 
quickly before users impact is too problematic.

Cheers,

Patch

diff -r 61463b8fcef8 -r 332d908d7b8a mercurial/ui.py
--- a/mercurial/ui.py	Sun May 01 14:36:12 2016 -0500
+++ b/mercurial/ui.py	Thu May 05 16:29:31 2016 +0200
@@ -1161,6 +1161,9 @@ 
         - msg: message explaining what is deprecated and how to upgrade,
         - version: last version where the API will be supported,
         """
+        if not (self.configbool('devel', 'all-warnings')
+                or self.configbool('devel', 'deprec-warn')):
+            return
         msg += ("\n(compatibility will be dropped after Mercurial-%s,"
                 " update your code.)") % version
         self.develwarn(msg, stacklevel=2)