Patchwork [06,of,10,layering] cmdutil: mark dirstateguard as deprecated

login
register
mail settings
Submitter Augie Fackler
Date Nov. 22, 2016, 3:05 a.m.
Message ID <3c0eded240368fe2c276.1479783921@imladris.local>
Download mbox | patch
Permalink /patch/17682/
State Accepted
Headers show

Comments

Augie Fackler - Nov. 22, 2016, 3:05 a.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1479781014 18000
#      Mon Nov 21 21:16:54 2016 -0500
# Node ID 3c0eded240368fe2c276cbc5f29172e02f37869f
# Parent  fe0b18c02e53589b043cff35f6987fdf63d855fb
cmdutil: mark dirstateguard as deprecated

I sincerely doubt this is used in external code, as grepping the
extensions I keep locally (including Facebook's hgexperimental and
evolve) indicate nobody outside of core uses this. As such, I'd also
welcome just dropping this name forward entirely.
Yuya Nishihara - Nov. 22, 2016, 2:12 p.m.
On Mon, 21 Nov 2016 22:05:21 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1479781014 18000
> #      Mon Nov 21 21:16:54 2016 -0500
> # Node ID 3c0eded240368fe2c276cbc5f29172e02f37869f
> # Parent  fe0b18c02e53589b043cff35f6987fdf63d855fb
> cmdutil: mark dirstateguard as deprecated
> 
> I sincerely doubt this is used in external code, as grepping the
> extensions I keep locally (including Facebook's hgexperimental and
> evolve) indicate nobody outside of core uses this. As such, I'd also
> welcome just dropping this name forward entirely.
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -3522,4 +3522,9 @@ def wrongtooltocontinue(repo, task):
>          hint = after[0]
>      raise error.Abort(_('no %s in progress') % task, hint=hint)
>  
> -dirstateguard = dirstateguardmod.dirstateguard
> +class dirstateguard(dirstateguardmod.dirstateguard):
> +    def __init__(self, repo, name):
> +        dirstateguardmod.dirstateguard.__init__(self, repo, name)
> +        repo.ui.deprecwarn(
> +            'dirstateguard has moved from cmdutil to dirstateguard',
> +            '4.1')

Seems fine to drop it without deprecation (but queued all patches for now.)

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3522,4 +3522,9 @@  def wrongtooltocontinue(repo, task):
         hint = after[0]
     raise error.Abort(_('no %s in progress') % task, hint=hint)
 
-dirstateguard = dirstateguardmod.dirstateguard
+class dirstateguard(dirstateguardmod.dirstateguard):
+    def __init__(self, repo, name):
+        dirstateguardmod.dirstateguard.__init__(self, repo, name)
+        repo.ui.deprecwarn(
+            'dirstateguard has moved from cmdutil to dirstateguard',
+            '4.1')