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

Matt Harbison mharbison72 at gmail.com
Sat Dec 1 04:11:00 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at 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.

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:


More information about the Mercurial-devel mailing list