Patchwork [1,of,3] extensions: use ismoduleinternal() thoroughly

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 30, 2016, 3:10 p.m.
Message ID <4c32b2f6aa852fc6260d.1472569812@mimosa>
Download mbox | patch
Permalink /patch/16480/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 30, 2016, 3:10 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1472223628 -32400
#      Sat Aug 27 00:00:28 2016 +0900
# Node ID 4c32b2f6aa852fc6260d63bb359d6b2129b8bede
# Parent  41fea255bd1cda8d0f482b2582aec8a29f86c303
extensions: use ismoduleinternal() thoroughly

"ships-with-hg-core" would be long enough to typo.
Augie Fackler - Aug. 30, 2016, 9:32 p.m.
On Wed, Aug 31, 2016 at 12:10:12AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1472223628 -32400
> #      Sat Aug 27 00:00:28 2016 +0900
> # Node ID 4c32b2f6aa852fc6260d63bb359d6b2129b8bede
> # Parent  41fea255bd1cda8d0f482b2582aec8a29f86c303
> extensions: use ismoduleinternal() thoroughly

Queued this one, thanks

>
> "ships-with-hg-core" would be long enough to typo.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2394,9 +2394,10 @@ def debugextensions(ui, **opts):
>      hgver = util.version()
>      fm = ui.formatter('debugextensions', opts)
>      for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
> +        isinternal = extensions.ismoduleinternal(extmod)
>          extsource = extmod.__file__
>          exttestedwith = getattr(extmod, 'testedwith', '').split()
> -        if exttestedwith == ['ships-with-hg-core']:
> +        if isinternal:
>              showtestedwith = ['internal']
>          else:
>              showtestedwith = exttestedwith
> @@ -2410,8 +2411,7 @@ def debugextensions(ui, **opts):
>              fm.write('name', '%s', extname)
>              if not exttestedwith:
>                  fm.plain(_(' (untested!)\n'))
> -            elif (exttestedwith == ['ships-with-hg-core']
> -                  or hgver in exttestedwith):
> +            elif isinternal or hgver in exttestedwith:
>                  fm.plain('\n')
>              else:
>                  lasttestedversion = exttestedwith[-1]
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -929,7 +929,7 @@ def _exceptionwarning(ui):
>                  break
>
>              # Never blame on extensions bundled with Mercurial.
> -            if testedwith == 'ships-with-hg-core':
> +            if extensions.ismoduleinternal(mod):
>                  continue
>
>              tested = [util.versiontuple(t, 2) for t in testedwith.split()]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2394,9 +2394,10 @@  def debugextensions(ui, **opts):
     hgver = util.version()
     fm = ui.formatter('debugextensions', opts)
     for extname, extmod in sorted(exts, key=operator.itemgetter(0)):
+        isinternal = extensions.ismoduleinternal(extmod)
         extsource = extmod.__file__
         exttestedwith = getattr(extmod, 'testedwith', '').split()
-        if exttestedwith == ['ships-with-hg-core']:
+        if isinternal:
             showtestedwith = ['internal']
         else:
             showtestedwith = exttestedwith
@@ -2410,8 +2411,7 @@  def debugextensions(ui, **opts):
             fm.write('name', '%s', extname)
             if not exttestedwith:
                 fm.plain(_(' (untested!)\n'))
-            elif (exttestedwith == ['ships-with-hg-core']
-                  or hgver in exttestedwith):
+            elif isinternal or hgver in exttestedwith:
                 fm.plain('\n')
             else:
                 lasttestedversion = exttestedwith[-1]
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -929,7 +929,7 @@  def _exceptionwarning(ui):
                 break
 
             # Never blame on extensions bundled with Mercurial.
-            if testedwith == 'ships-with-hg-core':
+            if extensions.ismoduleinternal(mod):
                 continue
 
             tested = [util.versiontuple(t, 2) for t in testedwith.split()]