# HG changeset patch # User Yuya Nishihara # Date 2015-02-18 13:53:53 # Node ID de14c3972c2f44c392387652f0273bfd7210d73c # Parent 79fceed676763ca219031ea67161b55c5747bf50 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. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -359,8 +359,10 @@ class sortdict(dict): 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 = []