Mercurial > hg
changeset 16865:a6543fdcf869
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.
author | Angel Ezquerra <angel.ezquerra@gmail.com> |
---|---|
date | Tue, 29 May 2012 23:26:55 +0200 |
parents | 92cfde8728ac |
children | 91f3ac205816 |
files | mercurial/config.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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):