# HG changeset patch # User Angel Ezquerra # Date 1338326815 -7200 # Node ID a6543fdcf86986f5b4d2e5ee3bb2db88ac231da1 # Parent 92cfde8728ac890f9c47d1f54cce456a30ccca98 config: make sortdict keys() and iterkeys() methods respect the item order The config.sortdict class is a simple "sorted dictionary" container class, based on python's regular dict container. The main difference compared to regular dicts is that sortdicts remember the order in which items have been added to it. Without this patch the items() method returns the sortdict elements in the right order. However, getting the list of keys by using the keys() or iterkeys() methods, and consequencly, looping through the container elements in a for loop does not respect that order. This patch fixes this problem. diff -r 92cfde8728ac -r a6543fdcf869 mercurial/config.py --- a/mercurial/config.py Mon Jun 04 16:59:57 2012 -0500 +++ b/mercurial/config.py Tue May 29 23:26:55 2012 +0200 @@ -35,6 +35,10 @@ def __delitem__(self, key): dict.__delitem__(self, key) self._list.remove(key) + def keys(self): + return self._list + def iterkeys(self): + return self._list.__iter__() class config(object): def __init__(self, data=None):