Patchwork [6,of,6] extensions: avoid shadowing imported module names with exthelper methods

login
register
mail settings
Submitter Matt Harbison
Date Dec. 1, 2018, 4:11 a.m.
Message ID <104266c4afd3519ddd09.1543637460@Envy>
Download mbox | patch
Permalink /patch/36892/
State New
Headers show

Comments

Matt Harbison - Dec. 1, 2018, 4:11 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1543636651 18000
#      Fri Nov 30 22:57:31 2018 -0500
# Node ID 104266c4afd3519ddd09e3718590af5062a85b70
# Parent  99150c56ee5f0f709380c46717fb283c615a911b
extensions: avoid shadowing imported module names with exthelper methods

The previous code worked, but confused pyscripter.

Patch

diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py
--- a/mercurial/exthelper.py
+++ b/mercurial/exthelper.py
@@ -8,10 +8,10 @@  from . import (
     commands,
     configitems,
     extensions,
-    fileset,
+    fileset as filesetmod,
     registrar,
-    revset,
-    templatekw,
+    revset as revsetmod,
+    templatekw as templatekwmod,
 )
 
 class exthelper(object):
@@ -132,13 +132,13 @@  class exthelper(object):
         for name, symbol in self._revsetsymbols:
             revsetpredicate(name)(symbol)
         # TODO: Figure out the calling extension name
-        revset.loadpredicate(ui, 'exthelper', revsetpredicate)
+        revsetmod.loadpredicate(ui, 'exthelper', revsetpredicate)
 
         filesetpredicate = registrar.filesetpredicate()
         for name, symbol in self._filesetsymbols:
             filesetpredicate(name)(symbol)
         # TODO: Figure out the calling extension name
-        fileset.loadpredicate(ui, 'exthelper', filesetpredicate)
+        filesetmod.loadpredicate(ui, 'exthelper', filesetpredicate)
 
         templatekeyword = registrar.templatekeyword()
         for name, kw, requires in self._templatekws:
@@ -147,7 +147,7 @@  class exthelper(object):
             else:
                 templatekeyword(name)(kw)
         # TODO: Figure out the calling extension name
-        templatekw.loadkeyword(ui, 'exthelper', templatekeyword)
+        templatekwmod.loadkeyword(ui, 'exthelper', templatekeyword)
 
         for ext, command, wrapper, opts in self._extcommandwrappers:
             if ext not in knownexts: