diff --git a/hgext/factotum.py b/hgext/factotum.py --- a/hgext/factotum.py +++ b/hgext/factotum.py @@ -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 --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py --- a/hgext/fastannotate/context.py +++ b/hgext/fastannotate/context.py @@ -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 --git a/hgext/fix.py b/hgext/fix.py --- a/hgext/fix.py +++ b/hgext/fix.py @@ -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 --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -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 --git a/hgext/sparse.py b/hgext/sparse.py --- a/hgext/sparse.py +++ b/hgext/sparse.py @@ -74,6 +74,7 @@ from __future__ import absolute_import from mercurial.i18n import _ +from mercurial.pycompat import setattr from mercurial import ( commands, dirstate, diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py --- a/hgext/win32mbcs.py +++ b/hgext/win32mbcs.py @@ -50,6 +50,7 @@ import sys from mercurial.i18n import _ +from mercurial.pycompat import setattr from mercurial 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, 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 --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -51,6 +51,7 @@ import time from .i18n import _ +from .pycompat import setattr from . import ( commandserver, diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -19,7 +19,10 @@ nullrev, short, ) -from .pycompat import open +from .pycompat import ( + open, + setattr, +) from . import ( bookmarks, diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -18,7 +18,10 @@ _, gettext, ) -from .pycompat import open +from .pycompat import ( + open, + setattr, +) from . import ( cmdutil, diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -15,6 +15,7 @@ from ..i18n import _ from ..node import hex, nullid, short +from ..pycompat import setattr from .common import ( ErrorResponse, diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -12,6 +12,7 @@ import zlib from .i18n import _ +from .pycompat import setattr from . import ( encoding, error, diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -113,6 +113,7 @@ nullrev, short, ) +from .pycompat import setattr from . import ( error, pycompat, 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 + setattr = setattr # this can't be parsed on Python 3 exec(b'def raisewithtb(exc, tb):\n' b' raise exc, None, tb\n') diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -12,6 +12,7 @@ import weakref from .node import nullrev +from .pycompat import setattr from . import ( obsolete, phases, diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -22,7 +22,10 @@ from .i18n import _ from .node import hex -from .pycompat import open +from .pycompat import ( + open, + setattr, +) from . import ( color, diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -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 --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -14,6 +14,7 @@ import threading from .i18n import _ +from .pycompat import setattr from . import ( encoding, error, diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -13,6 +13,7 @@ from .i18n import _ from .node import bin +from .pycompat import setattr from . import ( bundle2, changegroup as changegroupmod,