Patchwork [1,of,5] extensions: drop dead code trying to exclude deprecated disabled commands

login
register
mail settings
Submitter Yuya Nishihara
Date May 11, 2018, 1:29 p.m.
Message ID <7eca762c4cb88d42c923.1526045368@mimosa>
Download mbox | patch
Permalink /patch/31506/
State Accepted
Headers show

Comments

Yuya Nishihara - May 11, 2018, 1:29 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1525338823 -32400
#      Thu May 03 18:13:43 2018 +0900
# Node ID 7eca762c4cb88d42c9239c60fee743327f477c1a
# Parent  e2effc80f4388b5c9dc7effa3bd895350b5cf4ce
extensions: drop dead code trying to exclude deprecated disabled commands

Here 'ext' is a tuple, which means ext.__doc__ describes about the Python
tuple type. Fixing this would break 'hg help glog', which currently shows
some nice explanation, so this patch just removes the dead code.

  $ hg help glog
  'glog' is provided by the following extension:

      graphlog      command to view revision graphs from a shell (DEPRECATED)

  (use 'hg help extensions' for information on enabling extensions)
Gregory Szorc - May 12, 2018, 3:47 a.m.
On Fri, May 11, 2018 at 6:29 AM, Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1525338823 -32400
> #      Thu May 03 18:13:43 2018 +0900
> # Node ID 7eca762c4cb88d42c9239c60fee743327f477c1a
> # Parent  e2effc80f4388b5c9dc7effa3bd895350b5cf4ce
> extensions: drop dead code trying to exclude deprecated disabled commands
>

I queued parts 1-3 then ran out of review steam.


>
> Here 'ext' is a tuple, which means ext.__doc__ describes about the Python
> tuple type. Fixing this would break 'hg help glog', which currently shows
> some nice explanation, so this patch just removes the dead code.
>
>   $ hg help glog
>   'glog' is provided by the following extension:
>
>       graphlog      command to view revision graphs from a shell
> (DEPRECATED)
>
>   (use 'hg help extensions' for information on enabling extensions)
>
> diff --git a/mercurial/extensions.py b/mercurial/extensions.py
> --- a/mercurial/extensions.py
> +++ b/mercurial/extensions.py
> @@ -696,7 +696,7 @@ def disabledcmd(ui, cmd, strict=False):
>              ext = findcmd(cmd, name, path)
>              if ext:
>                  break
> -    if ext and 'DEPRECATED' not in ext.__doc__:
> +    if ext:
>          return ext
>
>      raise error.UnknownCommand(cmd)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -696,7 +696,7 @@  def disabledcmd(ui, cmd, strict=False):
             ext = findcmd(cmd, name, path)
             if ext:
                 break
-    if ext and 'DEPRECATED' not in ext.__doc__:
+    if ext:
         return ext
 
     raise error.UnknownCommand(cmd)