D2280: remotenames: port partway to python3 by using collections.MutableMapping

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Feb 16 17:04:21 EST 2018


durin42 updated this revision to Diff 5785.
durin42 marked an inline comment as done.
durin42 retitled this revision from "remotenames: port partway to python3" to "remotenames: port partway to python3 by using collections.MutableMapping".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2280?vs=5768&id=5785

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

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,7 @@
 
 from __future__ import absolute_import
 
-import UserDict
+import collections
 
 from mercurial.i18n import _
 
@@ -57,7 +57,7 @@
     default=True,
 )
 
-class lazyremotenamedict(UserDict.DictMixin):
+class lazyremotenamedict(collections.MutableMapping):
     """
     Read-only dict-like Class to lazily resolve remotename entries
 
@@ -110,6 +110,18 @@
         else:
             raise KeyError()
 
+    def __iter__(self):
+        return iter(self.potentialentries)
+
+    def __len__(self):
+        return len(self.potentialentries)
+
+    def __setitem__(self):
+        raise NotImplementedError
+
+    def __delitem__(self):
+        raise NotImplementedError
+
     def _fetchandcache(self, key):
         if key in self.cache:
             return self.cache[key]



To: durin42, #hg-reviewers
Cc: dlax, yuja, mercurial-devel


More information about the Mercurial-devel mailing list