remotenames: port partway to python3 by using collections.MutableMapping
authorAugie Fackler <augie@google.com>
Wed, 14 Feb 2018 23:23:57 -0500
changeset 36252 e37be270e163
parent 36251 c2c5f9f6fa21
child 36253 fbc29d9f552f
remotenames: port partway to python3 by using collections.MutableMapping test-logexchange.t doesn't pass after this, but at least the remotenames extension can be imported. Differential Revision: https://phab.mercurial-scm.org/D2280
hgext/remotenames.py
--- a/hgext/remotenames.py	Fri Feb 16 11:33:56 2018 -0800
+++ b/hgext/remotenames.py	Wed Feb 14 23:23:57 2018 -0500
@@ -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]