py3: manually import pycompat.setattr where it is needed
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 06 Oct 2019 14:58:42 -0400
changeset 43087 66f2cc210a29
parent 43086 bbcbb82e3589
child 43088 0d612db7047c
py3: manually import pycompat.setattr where it is needed Continuing to eliminate the implicit import of symbols in the Python 3 source transformer so we can eliminate it. Differential Revision: https://phab.mercurial-scm.org/D7007
hgext/factotum.py
hgext/fastannotate/context.py
hgext/fix.py
hgext/lfs/wrapper.py
hgext/sparse.py
hgext/win32mbcs.py
mercurial/__init__.py
mercurial/chgserver.py
mercurial/cmdutil.py
mercurial/extensions.py
mercurial/hgweb/webutil.py
mercurial/mdiff.py
mercurial/phases.py
mercurial/pycompat.py
mercurial/repoview.py
mercurial/ui.py
mercurial/util.py
mercurial/vfs.py
mercurial/wireprotov1peer.py
--- a/hgext/factotum.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/hgext/factotum.py	Sun Oct 06 14:58:42 2019 -0400
@@ -49,6 +49,7 @@
 
 import os
 from mercurial.i18n import _
+from mercurial.pycompat import setattr
 from mercurial.utils import procutil
 from mercurial import (
     error,
--- a/hgext/fastannotate/context.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/hgext/fastannotate/context.py	Sun Oct 06 14:58:42 2019 -0400
@@ -13,7 +13,10 @@
 import os
 
 from mercurial.i18n import _
-from mercurial.pycompat import open
+from mercurial.pycompat import (
+    open,
+    setattr,
+)
 from mercurial import (
     error,
     linelog as linelogmod,
--- a/hgext/fix.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/hgext/fix.py	Sun Oct 06 14:58:42 2019 -0400
@@ -132,6 +132,7 @@
 from mercurial.i18n import _
 from mercurial.node import nullrev
 from mercurial.node import wdirrev
+from mercurial.pycompat import setattr
 
 from mercurial.utils import (
     procutil,
--- a/hgext/lfs/wrapper.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/hgext/lfs/wrapper.py	Sun Oct 06 14:58:42 2019 -0400
@@ -11,6 +11,7 @@
 
 from mercurial.i18n import _
 from mercurial.node import bin, hex, nullid, short
+from mercurial.pycompat import setattr
 
 from mercurial import (
     bundle2,
--- a/hgext/sparse.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/hgext/sparse.py	Sun Oct 06 14:58:42 2019 -0400
@@ -74,6 +74,7 @@
 from __future__ import absolute_import
 
 from mercurial.i18n import _
+from mercurial.pycompat import setattr
 from mercurial import (
     commands,
     dirstate,
--- a/hgext/win32mbcs.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/hgext/win32mbcs.py	Sun Oct 06 14:58:42 2019 -0400
@@ -50,6 +50,7 @@
 import sys
 
 from mercurial.i18n import _
+from mercurial.pycompat import setattr
 from mercurial import (
     encoding,
     error,
--- a/mercurial/__init__.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/__init__.py	Sun Oct 06 14:58:42 2019 -0400
@@ -171,7 +171,7 @@
                 r, c = t.start
                 l = (
                     b'; from mercurial.pycompat import '
-                    b'delattr, getattr, hasattr, setattr\n'
+                    b'delattr, getattr, hasattr\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\x0e'
+    BYTECODEHEADER = b'HG\x00\x0f'
 
     class hgloader(importlib.machinery.SourceFileLoader):
         """Custom module loader that transforms source code.
--- a/mercurial/chgserver.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/chgserver.py	Sun Oct 06 14:58:42 2019 -0400
@@ -51,6 +51,7 @@
 import time
 
 from .i18n import _
+from .pycompat import setattr
 
 from . import (
     commandserver,
--- a/mercurial/cmdutil.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/cmdutil.py	Sun Oct 06 14:58:42 2019 -0400
@@ -19,7 +19,10 @@
     nullrev,
     short,
 )
-from .pycompat import open
+from .pycompat import (
+    open,
+    setattr,
+)
 
 from . import (
     bookmarks,
--- a/mercurial/extensions.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/extensions.py	Sun Oct 06 14:58:42 2019 -0400
@@ -18,7 +18,10 @@
     _,
     gettext,
 )
-from .pycompat import open
+from .pycompat import (
+    open,
+    setattr,
+)
 
 from . import (
     cmdutil,
--- a/mercurial/hgweb/webutil.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/hgweb/webutil.py	Sun Oct 06 14:58:42 2019 -0400
@@ -15,6 +15,7 @@
 
 from ..i18n import _
 from ..node import hex, nullid, short
+from ..pycompat import setattr
 
 from .common import (
     ErrorResponse,
--- a/mercurial/mdiff.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/mdiff.py	Sun Oct 06 14:58:42 2019 -0400
@@ -12,6 +12,7 @@
 import zlib
 
 from .i18n import _
+from .pycompat import setattr
 from . import (
     encoding,
     error,
--- a/mercurial/phases.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/phases.py	Sun Oct 06 14:58:42 2019 -0400
@@ -113,6 +113,7 @@
     nullrev,
     short,
 )
+from .pycompat import setattr
 from . import (
     error,
     pycompat,
--- a/mercurial/pycompat.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/pycompat.py	Sun Oct 06 14:58:42 2019 -0400
@@ -355,6 +355,7 @@
     strurl = identity
     bytesurl = identity
     open = open
+    setattr = setattr
 
     # this can't be parsed on Python 3
     exec(b'def raisewithtb(exc, tb):\n' b'    raise exc, None, tb\n')
--- a/mercurial/repoview.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/repoview.py	Sun Oct 06 14:58:42 2019 -0400
@@ -12,6 +12,7 @@
 import weakref
 
 from .node import nullrev
+from .pycompat import setattr
 from . import (
     obsolete,
     phases,
--- a/mercurial/ui.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/ui.py	Sun Oct 06 14:58:42 2019 -0400
@@ -22,7 +22,10 @@
 
 from .i18n import _
 from .node import hex
-from .pycompat import open
+from .pycompat import (
+    open,
+    setattr,
+)
 
 from . import (
     color,
--- a/mercurial/util.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/util.py	Sun Oct 06 14:58:42 2019 -0400
@@ -35,7 +35,10 @@
 import warnings
 
 from .thirdparty import attr
-from .pycompat import open
+from .pycompat import (
+    open,
+    setattr,
+)
 from hgdemandimport import tracing
 from . import (
     encoding,
--- a/mercurial/vfs.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/vfs.py	Sun Oct 06 14:58:42 2019 -0400
@@ -14,6 +14,7 @@
 import threading
 
 from .i18n import _
+from .pycompat import setattr
 from . import (
     encoding,
     error,
--- a/mercurial/wireprotov1peer.py	Sun Oct 06 14:51:45 2019 -0400
+++ b/mercurial/wireprotov1peer.py	Sun Oct 06 14:58:42 2019 -0400
@@ -13,6 +13,7 @@
 
 from .i18n import _
 from .node import bin
+from .pycompat import setattr
 from . import (
     bundle2,
     changegroup as changegroupmod,