changeset 23261:79858e66a7ce

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.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 15 Oct 2014 12:39:19 -0700
parents 565f97e71ce3
children 86a8658c77ff
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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'''