D2847: remotenames: work around move of ABCs in collections

2018-03-15 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG623193ef691b: remotenames: work around move of ABCs in 
collections (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2847?vs=7037=7065

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

AFFECTED FILES
  hgext/remotenames.py

CHANGE DETAILS

diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -22,22 +22,28 @@
 
 from __future__ import absolute_import
 
-import collections
-
 from mercurial.i18n import _
 
 from mercurial.node import (
 bin,
 )
 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
 



To: durin42, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2847: remotenames: work around move of ABCs in collections

2018-03-14 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D2847#45947, @yuja wrote:
  
  > Could be either `import collections.abc` or adding `collections.abc` to
  >  `list_stdlib_modules`.
  
  
  Sadly, neither worked :(
  
  The import checker currently bans /all/ `from ... import ...` statements on 
stdlib modules (sigh, probably my fault), and `import collections.abc` goes 
sideways on Python 2. What I've done seems to work though...

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2847: remotenames: work around move of ABCs in collections

2018-03-14 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 7037.
durin42 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2847?vs=7021=7037

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

AFFECTED FILES
  hgext/remotenames.py

CHANGE DETAILS

diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -22,22 +22,28 @@
 
 from __future__ import absolute_import
 
-import collections
-
 from mercurial.i18n import _
 
 from mercurial.node import (
 bin,
 )
 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
 



To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2847: remotenames: work around move of ABCs in collections

2018-03-14 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Could be either `import collections.abc` or adding `collections.abc` to
  `list_stdlib_modules`.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2847: remotenames: work around move of ABCs in collections

2018-03-13 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 7021.
durin42 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2847?vs=7004=7021

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

AFFECTED FILES
  hgext/remotenames.py

CHANGE DETAILS

diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -23,6 +23,11 @@
 from __future__ import absolute_import
 
 import collections
+try:
+from collections import abc
+mutablemapping = abc.MutableMapping
+except ImportError:
+mutablemapping = collections.MutableMapping
 
 from mercurial.i18n import _
 
@@ -56,7 +61,7 @@
 default=True,
 )
 
-class lazyremotenamedict(collections.MutableMapping):
+class lazyremotenamedict(mutablemapping):
 """
 Read-only dict-like Class to lazily resolve remotename entries
 



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2847: remotenames: work around move of ABCs in collections

2018-03-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This starts warning in Python 3.7, and will break in 3.8.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotenames.py

CHANGE DETAILS

diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -22,7 +22,12 @@
 
 from __future__ import absolute_import
 
-import collections
+try:
+from collections import abc
+MutableMapping = abc.MutableMapping
+except ImportError:
+import collections
+MutableMapping = collections.MutableMapping
 
 from mercurial.i18n import _
 
@@ -56,7 +61,7 @@
 default=True,
 )
 
-class lazyremotenamedict(collections.MutableMapping):
+class lazyremotenamedict(MutableMapping):
 """
 Read-only dict-like Class to lazily resolve remotename entries
 



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel