# HG changeset patch # User Gregory Szorc # Date 1570388322 14400 # Node ID 66f2cc210a29eeac8a5d17e4b37525d71048dd3f # Parent bbcbb82e358968919a9832000fe9b031d6c62d23 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 diff -r bbcbb82e3589 -r 66f2cc210a29 hgext/factotum.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, diff -r bbcbb82e3589 -r 66f2cc210a29 hgext/fastannotate/context.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 hgext/fix.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 hgext/lfs/wrapper.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 hgext/sparse.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 hgext/win32mbcs.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/__init__.py --- 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. diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/chgserver.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/cmdutil.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/extensions.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/hgweb/webutil.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/mdiff.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/phases.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/pycompat.py --- 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') diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/repoview.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/ui.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/util.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/vfs.py --- 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, diff -r bbcbb82e3589 -r 66f2cc210a29 mercurial/wireprotov1peer.py --- 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,