sortdict: add insert method
authorSean Farley <sean.michael.farley@gmail.com>
Wed, 15 Oct 2014 12:39:19 -0700
changeset 23261 79858e66a7ce
parent 23260 565f97e71ce3
child 23262 86a8658c77ff
sortdict: add insert method Future patches will allow extensions to choose which order a namespace should output in the log, so we add a way for sortdict to insert to a specific location.
mercurial/util.py
--- a/mercurial/util.py	Sun Nov 09 13:15:28 2014 -0800
+++ b/mercurial/util.py	Wed Oct 15 12:39:19 2014 -0700
@@ -372,6 +372,9 @@
     def iteritems(self):
         for k in self._list:
             yield k, self[k]
+    def insert(self, index, key, val):
+        self._list.insert(index, key)
+        dict.__setitem__(self, key, val)
 
 class lrucachedict(object):
     '''cache most recent gets from or sets to this dictionary'''