D7009: py3: manually import getattr where it is needed

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Oct 6 17:37:29 EDT 2019


indygreg created this revision.
Herald added a reviewer: durin42.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The march continues.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7009

AFFECTED FILES
  hgext/convert/cvs.py
  hgext/convert/transport.py
  hgext/fastannotate/context.py
  hgext/fastannotate/support.py
  hgext/histedit.py
  hgext/infinitepush/__init__.py
  hgext/keyword.py
  hgext/largefiles/storefactory.py
  hgext/lfs/blobstore.py
  hgext/lfs/wrapper.py
  hgext/mq.py
  hgext/phabricator.py
  hgext/remotefilelog/basepack.py
  hgext/remotefilelog/contentstore.py
  hgext/strip.py
  hgext/win32mbcs.py
  mercurial/__init__.py
  mercurial/bookmarks.py
  mercurial/chgserver.py
  mercurial/cmdutil.py
  mercurial/color.py
  mercurial/commandserver.py
  mercurial/config.py
  mercurial/context.py
  mercurial/crecord.py
  mercurial/debugcommands.py
  mercurial/dispatch.py
  mercurial/encoding.py
  mercurial/extensions.py
  mercurial/filemerge.py
  mercurial/fileset.py
  mercurial/filesetlang.py
  mercurial/help.py
  mercurial/hg.py
  mercurial/hgweb/common.py
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/server.py
  mercurial/hgweb/webcommands.py
  mercurial/hgweb/wsgicgi.py
  mercurial/hook.py
  mercurial/httppeer.py
  mercurial/i18n.py
  mercurial/keepalive.py
  mercurial/localrepo.py
  mercurial/lock.py
  mercurial/lsprof.py
  mercurial/mail.py
  mercurial/manifest.py
  mercurial/mdiff.py
  mercurial/narrowspec.py
  mercurial/obsolete.py
  mercurial/phases.py
  mercurial/policy.py
  mercurial/posix.py
  mercurial/profiling.py
  mercurial/pure/osutil.py
  mercurial/pycompat.py
  mercurial/repoview.py
  mercurial/revlog.py
  mercurial/revlogutils/deltas.py
  mercurial/revset.py
  mercurial/revsetlang.py
  mercurial/scmposix.py
  mercurial/scmutil.py
  mercurial/smartset.py
  mercurial/sshpeer.py
  mercurial/sslutil.py
  mercurial/store.py
  mercurial/subrepoutil.py
  mercurial/templater.py
  mercurial/templateutil.py
  mercurial/testing/storage.py
  mercurial/ui.py
  mercurial/unionrepo.py
  mercurial/upgrade.py
  mercurial/url.py
  mercurial/urllibcompat.py
  mercurial/util.py
  mercurial/utils/compression.py
  mercurial/utils/procutil.py
  mercurial/vfs.py
  mercurial/windows.py
  mercurial/wireprotoframing.py
  mercurial/wireprototypes.py
  mercurial/wireprotov1peer.py
  mercurial/wireprotov1server.py

CHANGE DETAILS

diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
--- a/mercurial/wireprotov1server.py
+++ b/mercurial/wireprotov1server.py
@@ -15,6 +15,7 @@
     hex,
     nullid,
 )
+from .pycompat import getattr
 
 from . import (
     bundle2,
diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -13,7 +13,10 @@
 
 from .i18n import _
 from .node import bin
-from .pycompat import setattr
+from .pycompat import (
+    getattr,
+    setattr,
+)
 from . import (
     bundle2,
     changegroup as changegroupmod,
diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py
--- a/mercurial/wireprototypes.py
+++ b/mercurial/wireprototypes.py
@@ -10,6 +10,7 @@
     hex,
 )
 from .i18n import _
+from .pycompat import getattr
 from .thirdparty import attr
 from . import (
     error,
diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py
--- a/mercurial/wireprotoframing.py
+++ b/mercurial/wireprotoframing.py
@@ -15,6 +15,7 @@
 import struct
 
 from .i18n import _
+from .pycompat import getattr
 from .thirdparty import attr
 from . import (
     encoding,
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -16,6 +16,7 @@
 import sys
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -14,7 +14,10 @@
 import threading
 
 from .i18n import _
-from .pycompat import setattr
+from .pycompat import (
+    getattr,
+    setattr,
+)
 from . import (
     encoding,
     error,
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -20,7 +20,10 @@
 import time
 
 from ..i18n import _
-from ..pycompat import open
+from ..pycompat import (
+    getattr,
+    open,
+)
 
 from .. import (
     encoding,
diff --git a/mercurial/utils/compression.py b/mercurial/utils/compression.py
--- a/mercurial/utils/compression.py
+++ b/mercurial/utils/compression.py
@@ -10,6 +10,7 @@
 import collections
 import zlib
 
+from ..pycompat import getattr
 from .. import (
     error,
     i18n,
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -36,6 +36,7 @@
 
 from .thirdparty import attr
 from .pycompat import (
+    getattr,
     open,
     setattr,
 )
diff --git a/mercurial/urllibcompat.py b/mercurial/urllibcompat.py
--- a/mercurial/urllibcompat.py
+++ b/mercurial/urllibcompat.py
@@ -6,6 +6,7 @@
 # GNU General Public License version 2 or any later version.
 from __future__ import absolute_import
 
+from .pycompat import getattr
 from . import pycompat
 
 _sysstr = pycompat.sysstr
diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -15,6 +15,7 @@
 import sys
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -10,6 +10,7 @@
 import stat
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     changelog,
     error,
diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -14,6 +14,7 @@
 from __future__ import absolute_import
 
 from .i18n import _
+from .pycompat import getattr
 
 from . import (
     changelog,
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -23,6 +23,7 @@
 from .i18n import _
 from .node import hex
 from .pycompat import (
+    getattr,
     open,
     setattr,
 )
diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py
--- a/mercurial/testing/storage.py
+++ b/mercurial/testing/storage.py
@@ -14,6 +14,7 @@
     nullid,
     nullrev,
 )
+from ..pycompat import getattr
 from .. import (
     error,
     mdiff,
diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -11,6 +11,7 @@
 import types
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     error,
     pycompat,
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -68,6 +68,7 @@
 import os
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     config,
     encoding,
diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py
--- a/mercurial/subrepoutil.py
+++ b/mercurial/subrepoutil.py
@@ -13,6 +13,7 @@
 import re
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     config,
     error,
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -14,6 +14,7 @@
 import stat
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     changelog,
     error,
diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -15,6 +15,7 @@
 import ssl
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -11,6 +11,7 @@
 import uuid
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     error,
     pycompat,
diff --git a/mercurial/smartset.py b/mercurial/smartset.py
--- a/mercurial/smartset.py
+++ b/mercurial/smartset.py
@@ -7,6 +7,7 @@
 
 from __future__ import absolute_import
 
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -26,6 +26,7 @@
     wdirid,
     wdirrev,
 )
+from .pycompat import getattr
 
 from . import (
     copies as copiesmod,
diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py
--- a/mercurial/scmposix.py
+++ b/mercurial/scmposix.py
@@ -6,6 +6,7 @@
 import os
 import sys
 
+from .pycompat import getattr
 from . import (
     encoding,
     pycompat,
diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -10,6 +10,7 @@
 import string
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     error,
     node,
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -10,6 +10,7 @@
 import re
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     dagop,
     destutil,
diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -15,6 +15,7 @@
 # import stuff from node for others to import from revlog
 from ..node import nullrev
 from ..i18n import _
+from ..pycompat import getattr
 
 from .constants import (
     REVIDX_ISCENSORED,
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -35,6 +35,7 @@
     wdirrev,
 )
 from .i18n import _
+from .pycompat import getattr
 from .revlogutils.constants import (
     FLAG_GENERALDELTA,
     FLAG_INLINE_DATA,
diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -12,7 +12,10 @@
 import weakref
 
 from .node import nullrev
-from .pycompat import setattr
+from .pycompat import (
+    getattr,
+    setattr,
+)
 from . import (
     obsolete,
     phases,
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -355,6 +355,7 @@
     strurl = identity
     bytesurl = identity
     open = open
+    getattr = getattr
     hasattr = hasattr
     setattr = setattr
 
diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -13,6 +13,7 @@
 import socket
 import stat as statmod
 
+from ..pycompat import getattr
 from .. import (
     encoding,
     pycompat,
diff --git a/mercurial/profiling.py b/mercurial/profiling.py
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -10,7 +10,10 @@
 import contextlib
 
 from .i18n import _
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 from . import (
     encoding,
     error,
diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -21,7 +21,10 @@
 import unicodedata
 
 from .i18n import _
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 from . import (
     encoding,
     error,
diff --git a/mercurial/policy.py b/mercurial/policy.py
--- a/mercurial/policy.py
+++ b/mercurial/policy.py
@@ -10,6 +10,8 @@
 import os
 import sys
 
+from .pycompat import getattr
+
 # Rules for how modules can be loaded. Values are:
 #
 #    c - require C extensions
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -113,7 +113,10 @@
     nullrev,
     short,
 )
-from .pycompat import setattr
+from .pycompat import (
+    getattr,
+    setattr,
+)
 from . import (
     error,
     pycompat,
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -74,6 +74,7 @@
 import struct
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 from .i18n import _
+from .pycompat import getattr
 from .interfaces import repository
 from . import (
     error,
diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -12,7 +12,10 @@
 import zlib
 
 from .i18n import _
-from .pycompat import setattr
+from .pycompat import (
+    getattr,
+    setattr,
+)
 from . import (
     encoding,
     error,
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -19,6 +19,7 @@
     nullid,
     nullrev,
 )
+from .pycompat import getattr
 from . import (
     error,
     mdiff,
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -19,7 +19,10 @@
 import time
 
 from .i18n import _
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 from . import (
     encoding,
     error,
diff --git a/mercurial/lsprof.py b/mercurial/lsprof.py
--- a/mercurial/lsprof.py
+++ b/mercurial/lsprof.py
@@ -3,6 +3,8 @@
 import _lsprof
 import sys
 
+from .pycompat import getattr
+
 Profiler = _lsprof.Profiler
 
 # PyPy doesn't expose profiler_entry from the module.
diff --git a/mercurial/lock.py b/mercurial/lock.py
--- a/mercurial/lock.py
+++ b/mercurial/lock.py
@@ -16,6 +16,7 @@
 import warnings
 
 from .i18n import _
+from .pycompat import getattr
 
 from . import (
     encoding,
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -23,6 +23,7 @@
     nullrev,
     short,
 )
+from .pycompat import getattr
 from . import (
     bookmarks,
     branchmap,
diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -92,6 +92,7 @@
 import threading
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     node,
     pycompat,
diff --git a/mercurial/i18n.py b/mercurial/i18n.py
--- a/mercurial/i18n.py
+++ b/mercurial/i18n.py
@@ -12,6 +12,7 @@
 import os
 import sys
 
+from .pycompat import getattr
 from . import (
     encoding,
     pycompat,
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -16,6 +16,7 @@
 import weakref
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     bundle2,
     error,
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -11,6 +11,7 @@
 import sys
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     demandimport,
     encoding,
diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py
+++ b/mercurial/hgweb/wsgicgi.py
@@ -12,6 +12,7 @@
 
 import os
 
+from ..pycompat import getattr
 from .. import pycompat
 
 from ..utils import procutil
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -14,6 +14,7 @@
 
 from ..i18n import _
 from ..node import hex, short
+from ..pycompat import getattr
 
 from .common import (
     ErrorResponse,
diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -17,7 +17,10 @@
 import wsgiref.validate
 
 from ..i18n import _
-from ..pycompat import open
+from ..pycompat import (
+    getattr,
+    open,
+)
 
 from .. import (
     encoding,
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -18,6 +18,7 @@
     permhooks,
     statusmessage,
 )
+from ..pycompat import getattr
 
 from .. import (
     encoding,
diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -14,7 +14,10 @@
 import os
 import stat
 
-from ..pycompat import open
+from ..pycompat import (
+    getattr,
+    open,
+)
 from .. import (
     encoding,
     pycompat,
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -16,6 +16,7 @@
 
 from .i18n import _
 from .node import nullid
+from .pycompat import getattr
 
 from . import (
     bookmarks,
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -16,6 +16,7 @@
     _,
     gettext,
 )
+from .pycompat import getattr
 from . import (
     cmdutil,
     encoding,
diff --git a/mercurial/filesetlang.py b/mercurial/filesetlang.py
--- a/mercurial/filesetlang.py
+++ b/mercurial/filesetlang.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     error,
     parser,
diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -11,6 +11,7 @@
 import re
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     error,
     filesetlang,
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -18,7 +18,10 @@
     nullid,
     short,
 )
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 
 from . import (
     encoding,
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -19,6 +19,7 @@
     gettext,
 )
 from .pycompat import (
+    getattr,
     open,
     setattr,
 )
diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -11,6 +11,7 @@
 import os
 import unicodedata
 
+from .pycompat import getattr
 from . import (
     error,
     policy,
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -20,6 +20,7 @@
 
 
 from .i18n import _
+from .pycompat import getattr
 
 from hgdemandimport import tracing
 
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -32,7 +32,10 @@
     nullrev,
     short,
 )
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 from . import (
     bundle2,
     changegroup,
diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -16,7 +16,10 @@
 import signal
 
 from .i18n import _
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 from . import (
     encoding,
     error,
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -23,7 +23,10 @@
     wdirfilenodeids,
     wdirhex,
 )
-from .pycompat import open
+from .pycompat import (
+    getattr,
+    open,
+)
 from . import (
     copies,
     dagop,
diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -11,6 +11,7 @@
 import os
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     error,
     pycompat,
diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -24,6 +24,7 @@
     from .thirdparty import selectors2 as selectors
 
 from .i18n import _
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -10,6 +10,7 @@
 import re
 
 from .i18n import _
+from .pycompat import getattr
 
 from . import (
     encoding,
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -20,6 +20,7 @@
     short,
 )
 from .pycompat import (
+    getattr,
     open,
     setattr,
 )
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -51,7 +51,10 @@
 import time
 
 from .i18n import _
-from .pycompat import setattr
+from .pycompat import (
+    getattr,
+    setattr,
+)
 
 from . import (
     commandserver,
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -17,6 +17,7 @@
     short,
     wdirid,
 )
+from .pycompat import getattr
 from . import (
     encoding,
     error,
diff --git a/mercurial/__init__.py b/mercurial/__init__.py
--- a/mercurial/__init__.py
+++ b/mercurial/__init__.py
@@ -171,7 +171,7 @@
                 r, c = t.start
                 l = (
                     b'; from mercurial.pycompat import '
-                    b'delattr, getattr\n'
+                    b'delattr\n'
                 )
                 for u in tokenize.tokenize(io.BytesIO(l).readline):
                     if u.type in (tokenize.ENCODING, token.ENDMARKER):
@@ -220,7 +220,7 @@
     # ``replacetoken`` or any mechanism that changes semantics of module
     # loading is changed. Otherwise cached bytecode may get loaded without
     # the new transformation mechanisms applied.
-    BYTECODEHEADER = b'HG\x00\x10'
+    BYTECODEHEADER = b'HG\x00\x11'
 
     class hgloader(importlib.machinery.SourceFileLoader):
         """Custom module loader that transforms source code.
diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py
--- a/hgext/win32mbcs.py
+++ b/hgext/win32mbcs.py
@@ -50,7 +50,7 @@
 import sys
 
 from mercurial.i18n import _
-from mercurial.pycompat import setattr
+from mercurial.pycompat import getattr, setattr
 from mercurial import (
     encoding,
     error,
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -6,6 +6,7 @@
 from __future__ import absolute_import
 
 from mercurial.i18n import _
+from mercurial.pycompat import getattr
 from mercurial import (
     bookmarks as bookmarksmod,
     cmdutil,
diff --git a/hgext/remotefilelog/contentstore.py b/hgext/remotefilelog/contentstore.py
--- a/hgext/remotefilelog/contentstore.py
+++ b/hgext/remotefilelog/contentstore.py
@@ -3,6 +3,7 @@
 import threading
 
 from mercurial.node import hex, nullid
+from mercurial.pycompat import getattr
 from mercurial import (
     mdiff,
     pycompat,
diff --git a/hgext/remotefilelog/basepack.py b/hgext/remotefilelog/basepack.py
--- a/hgext/remotefilelog/basepack.py
+++ b/hgext/remotefilelog/basepack.py
@@ -9,7 +9,10 @@
 import time
 
 from mercurial.i18n import _
-from mercurial.pycompat import open
+from mercurial.pycompat import (
+    getattr,
+    open,
+)
 from mercurial import (
     node as nodemod,
     policy,
diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -49,6 +49,7 @@
 
 from mercurial.node import bin, nullid
 from mercurial.i18n import _
+from mercurial.pycompat import getattr
 from mercurial import (
     cmdutil,
     context,
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -76,7 +76,10 @@
     nullrev,
     short,
 )
-from mercurial.pycompat import open
+from mercurial.pycompat import (
+    getattr,
+    open,
+)
 from mercurial import (
     cmdutil,
     commands,
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -11,7 +11,10 @@
 
 from mercurial.i18n import _
 from mercurial.node import bin, hex, nullid, short
-from mercurial.pycompat import setattr
+from mercurial.pycompat import (
+    getattr,
+    setattr,
+)
 
 from mercurial import (
     bundle2,
diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -16,6 +16,7 @@
 import socket
 
 from mercurial.i18n import _
+from mercurial.pycompat import getattr
 
 from mercurial import (
     encoding,
diff --git a/hgext/largefiles/storefactory.py b/hgext/largefiles/storefactory.py
--- a/hgext/largefiles/storefactory.py
+++ b/hgext/largefiles/storefactory.py
@@ -6,7 +6,7 @@
 import re
 
 from mercurial.i18n import _
-
+from mercurial.pycompat import getattr
 from mercurial import (
     error,
     hg,
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -90,6 +90,7 @@
 import weakref
 
 from mercurial.i18n import _
+from mercurial.pycompat import getattr
 from mercurial.hgweb import webcommands
 
 from mercurial import (
diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py
--- a/hgext/infinitepush/__init__.py
+++ b/hgext/infinitepush/__init__.py
@@ -103,7 +103,10 @@
 
 from mercurial.i18n import _
 
-from mercurial.pycompat import open
+from mercurial.pycompat import (
+    getattr,
+    open,
+)
 
 from mercurial.utils import (
     procutil,
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -206,7 +206,10 @@
 import struct
 
 from mercurial.i18n import _
-from mercurial.pycompat import open
+from mercurial.pycompat import (
+    getattr,
+    open,
+)
 from mercurial import (
     bundle2,
     cmdutil,
diff --git a/hgext/fastannotate/support.py b/hgext/fastannotate/support.py
--- a/hgext/fastannotate/support.py
+++ b/hgext/fastannotate/support.py
@@ -7,6 +7,7 @@
 
 from __future__ import absolute_import
 
+from mercurial.pycompat import getattr
 from mercurial import (
     context as hgcontext,
     dagop,
diff --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py
--- a/hgext/fastannotate/context.py
+++ b/hgext/fastannotate/context.py
@@ -14,6 +14,7 @@
 
 from mercurial.i18n import _
 from mercurial.pycompat import (
+    getattr,
     open,
     setattr,
 )
diff --git a/hgext/convert/transport.py b/hgext/convert/transport.py
--- a/hgext/convert/transport.py
+++ b/hgext/convert/transport.py
@@ -25,6 +25,7 @@
 Pool = svn.core.Pool
 SubversionException = svn.core.SubversionException
 
+from mercurial.pycompat import getattr
 from mercurial import util
 
 # Some older versions of the Python bindings need to be
diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py
--- a/hgext/convert/cvs.py
+++ b/hgext/convert/cvs.py
@@ -12,7 +12,10 @@
 import socket
 
 from mercurial.i18n import _
-from mercurial.pycompat import open
+from mercurial.pycompat import (
+    getattr,
+    open,
+)
 from mercurial import (
     encoding,
     error,



To: indygreg, durin42, #hg-reviewers
Cc: Kwan, mercurial-devel, spectral


More information about the Mercurial-devel mailing list