# HG changeset patch # User Augie Fackler # Date 1520978103 14400 # Node ID b710fdebd0dbbf5ca42b8b482847fd7994c658bb # Parent f21798a6bc20a9374d6a73fdf6a85a03702e55aa remotenames: work around move of ABCs in collections This starts warning in Python 3.7, and will break in 3.8. The import is performed in a curious place because `import collections.abc` explodes badly on Python 2.7, and `from collections import abc` flunks our import checker. Differential Revision: https://phab.mercurial-scm.org/D2847 diff -r f21798a6bc20 -r b710fdebd0db hgext/remotenames.py --- a/hgext/remotenames.py Mon Feb 26 20:44:21 2018 +0800 +++ b/hgext/remotenames.py Tue Mar 13 17:55:03 2018 -0400 @@ -22,8 +22,6 @@ from __future__ import absolute_import -import collections - from mercurial.i18n import _ from mercurial.node import ( @@ -32,12 +30,20 @@ from mercurial import ( logexchange, namespaces, + pycompat, registrar, revsetlang, smartset, templateutil, ) +if pycompat.ispy3: + import collections.abc + mutablemapping = collections.abc.MutableMapping +else: + import collections + mutablemapping = collections.MutableMapping + # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or @@ -56,7 +62,7 @@ default=True, ) -class lazyremotenamedict(collections.MutableMapping): +class lazyremotenamedict(mutablemapping): """ Read-only dict-like Class to lazily resolve remotename entries