# HG changeset patch # User Yuya Nishihara # Date 2017-05-17 14:01:56 # Node ID 2d19664e257da7ad5cb97150d81838c25872fac7 # Parent 911057981ba4305013d9097885ad51762e8cee15 util: drop unneeded override, sortdict.copy() OrderedDict.copy() returns self.__class__(self). diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -568,13 +568,21 @@ def cachefunc(func): return f class sortdict(collections.OrderedDict): - '''a simple sorted dictionary''' + '''a simple sorted dictionary + + >>> d1 = sortdict([('a', 0), ('b', 1)]) + >>> d2 = d1.copy() + >>> d2 + sortdict([('a', 0), ('b', 1)]) + >>> d2.update([('a', 2)]) + >>> d2.keys() # should still be in last-set order + ['b', 'a'] + ''' + def __setitem__(self, key, value): if key in self: del self[key] super(sortdict, self).__setitem__(key, value) - def copy(self): - return sortdict(self) class _lrucachenode(object): """A node in a doubly linked list.