D2280: remotenames: port partway to python3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Feb 15 14:18:42 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  test-logexchange.t doesn't pass after this, but at least the
  remotenames extension can be imported.

REPOSITORY
  rHG Mercurial

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,10 @@
 
 from __future__ import absolute_import
 
-import UserDict
+try:
+    from UserDict import DictMixin
+except ImportError:
+    from collections import MutableMapping as DictMixin
 
 from mercurial.i18n import _
 
@@ -57,7 +60,7 @@
     default=True,
 )
 
-class lazyremotenamedict(UserDict.DictMixin):
+class lazyremotenamedict(DictMixin):
     """
     Read-only dict-like Class to lazily resolve remotename entries
 
@@ -110,6 +113,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: mercurial-devel


More information about the Mercurial-devel mailing list