sortdict: have update() accept either dict or iterable of key/value pairs
Future patches will make the templater store a sorted dict in the _hybrid object.
sortdict should be constructed from a sorted list.
--- a/mercurial/util.py Fri Mar 06 15:57:43 2015 -0800
+++ b/mercurial/util.py Wed Feb 18 22:53:53 2015 +0900
@@ -359,8 +359,10 @@
def __iter__(self):
return self._list.__iter__()
def update(self, src):
- for k in src:
- self[k] = src[k]
+ if isinstance(src, dict):
+ src = src.iteritems()
+ for k, v in src:
+ self[k] = v
def clear(self):
dict.clear(self)
self._list = []