[PATCH 1 of 2] sortdict: add iteritems method

Sean Farley sean.michael.farley at gmail.com
Thu Nov 6 23:09:54 UTC 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1413475012 25200
#      Thu Oct 16 08:56:52 2014 -0700
# Node ID 45fd23c47bb429c84e28a3303fb2a1097c5082e2
# Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
sortdict: add iteritems method

Nothing really fancy, just adding this method to make sure when iteritems is
used that it is iterated in correct order.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -367,10 +367,12 @@ class sortdict(dict):
             pass
     def keys(self):
         return self._list
     def iterkeys(self):
         return self._list.__iter__()
+    def iteritems(self):
+        return self.items().__iter__()
 
 class lrucachedict(object):
     '''cache most recent gets from or sets to this dictionary'''
     def __init__(self, maxsize):
         self._cache = {}


More information about the Mercurial-devel mailing list