Patchwork [1,of,4] devel: officially deprecate old style revset

login
register
mail settings
Submitter Pierre-Yves David
Date May 8, 2016, 9:35 p.m.
Message ID <70e701b45e36638fceff.1462743324@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/14973/
State Superseded
Commit b175d9cc3ee8f8ec5a441dd683d8ddf51ba5bf1b
Headers show

Comments

Pierre-Yves David - May 8, 2016, 9:35 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1462469010 -7200
#      Thu May 05 19:23:30 2016 +0200
# Node ID 70e701b45e36638fceffbb68d334b4f2478ecb76
# Parent  3fd94f603190e50690e654fc211ba9801ff2c457
# EXP-Topic deprecate
devel: officially deprecate old style revset

When we introduce the develwarning, we did not had an official deprecation API
and infrastructure. We can now officially deprecate the old way with a version
deadline.
Sean Farley - May 8, 2016, 9:37 p.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1462469010 -7200
> #      Thu May 05 19:23:30 2016 +0200
> # Node ID 70e701b45e36638fceffbb68d334b4f2478ecb76
> # Parent  3fd94f603190e50690e654fc211ba9801ff2c457
> # EXP-Topic deprecate
> devel: officially deprecate old style revset
>
> When we introduce the develwarning, we did not had an official deprecation API
> and infrastructure. We can now officially deprecate the old way with a version
> deadline.
>
> diff -r 3fd94f603190 -r 70e701b45e36 mercurial/revset.py
> --- a/mercurial/revset.py	Sun May 08 10:43:41 2016 +0200
> +++ b/mercurial/revset.py	Thu May 05 19:23:30 2016 +0200
> @@ -333,9 +333,9 @@ def getset(repo, subset, x):
>      # else case should not happen, because all non-func are internal,
>      # ignoring for now.
>      if x[0] == 'func' and x[1][0] == 'symbol' and x[1][1] in symbols:
> -        repo.ui.develwarn('revset "%s" use list instead of smartset, '
> -                          '(upgrade your code)' % x[1][1],
> -                          config='old-revset')
> +        repo.ui.deprecwarn('revset "%s" use list instead of smartset'

If I read this correctly, I think this should be 'revset "%s" uses a
list insted of a smartset'.
Pierre-Yves David - May 10, 2016, 10:44 a.m.
On 05/08/2016 11:37 PM, Sean Farley wrote:
> Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:
>
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>> # Date 1462469010 -7200
>> #      Thu May 05 19:23:30 2016 +0200
>> # Node ID 70e701b45e36638fceffbb68d334b4f2478ecb76
>> # Parent  3fd94f603190e50690e654fc211ba9801ff2c457
>> # EXP-Topic deprecate
>> devel: officially deprecate old style revset
>>
>> When we introduce the develwarning, we did not had an official deprecation API
>> and infrastructure. We can now officially deprecate the old way with a version
>> deadline.
>>
>> diff -r 3fd94f603190 -r 70e701b45e36 mercurial/revset.py
>> --- a/mercurial/revset.py	Sun May 08 10:43:41 2016 +0200
>> +++ b/mercurial/revset.py	Thu May 05 19:23:30 2016 +0200
>> @@ -333,9 +333,9 @@ def getset(repo, subset, x):
>>       # else case should not happen, because all non-func are internal,
>>       # ignoring for now.
>>       if x[0] == 'func' and x[1][0] == 'symbol' and x[1][1] in symbols:
>> -        repo.ui.develwarn('revset "%s" use list instead of smartset, '
>> -                          '(upgrade your code)' % x[1][1],
>> -                          config='old-revset')
>> +        repo.ui.deprecwarn('revset "%s" use list instead of smartset'
> If I read this correctly, I think this should be 'revset "%s" uses a
> list insted of a smartset'.

Good catch, but you probably mean "instead" ;-)

Can this be fixed in flight?

Patch

diff -r 3fd94f603190 -r 70e701b45e36 mercurial/revset.py
--- a/mercurial/revset.py	Sun May 08 10:43:41 2016 +0200
+++ b/mercurial/revset.py	Thu May 05 19:23:30 2016 +0200
@@ -333,9 +333,9 @@  def getset(repo, subset, x):
     # else case should not happen, because all non-func are internal,
     # ignoring for now.
     if x[0] == 'func' and x[1][0] == 'symbol' and x[1][1] in symbols:
-        repo.ui.develwarn('revset "%s" use list instead of smartset, '
-                          '(upgrade your code)' % x[1][1],
-                          config='old-revset')
+        repo.ui.deprecwarn('revset "%s" use list instead of smartset'
+                           % x[1][1],
+                           '3.9')
     return baseset(s)
 
 def _getrevsource(repo, r):
diff -r 3fd94f603190 -r 70e701b45e36 tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t	Sun May 08 10:43:41 2016 +0200
+++ b/tests/test-devel-warnings.t	Thu May 05 19:23:30 2016 +0200
@@ -122,7 +122,8 @@ 
   [255]
 
   $ hg log -r "oldstyle()" -T '{rev}\n'
-  devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob)
+  devel-warn: revset "oldstyle" use list instead of smartset
+  (compatibility will be dropped after Mercurial-3.9, update your code.) at: /home/marmoute/src/mercurial-dev/mercurial/revset.py:2335 (mfunc)
   0
   $ hg oldanddeprecated
   devel-warn: foorbar is deprecated, go shopping
@@ -143,7 +144,8 @@ 
    */mercurial/util.py:* in check (glob)
    $TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
   $ hg blackbox -l 9
-  1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob)
+  1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: revset "oldstyle" use list instead of smartset
+  (compatibility will be dropped after Mercurial-3.9, update your code.) at: /home/marmoute/src/mercurial-dev/mercurial/revset.py:2335 (mfunc)
   1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> log -r oldstyle() -T {rev}\n exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> oldanddeprecated
   1970/01/01 00:00:00 bob @cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b (5000)> devel-warn: foorbar is deprecated, go shopping