Mercurial > hg
comparison mercurial/util.py @ 31878:4d0465dd13d2
sortdict: fix .pop() to return a value
My future patch will need it.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 09 Apr 2017 11:57:09 +0900 |
parents | 9ff5a124d111 |
children | 12aca6770046 |
comparison
equal
deleted
inserted
replaced
31877:14c5a7637ecc | 31878:4d0465dd13d2 |
---|---|
553 return [(k, self[k]) for k in self._list] | 553 return [(k, self[k]) for k in self._list] |
554 def __delitem__(self, key): | 554 def __delitem__(self, key): |
555 dict.__delitem__(self, key) | 555 dict.__delitem__(self, key) |
556 self._list.remove(key) | 556 self._list.remove(key) |
557 def pop(self, key, *args, **kwargs): | 557 def pop(self, key, *args, **kwargs): |
558 dict.pop(self, key, *args, **kwargs) | |
559 try: | 558 try: |
560 self._list.remove(key) | 559 self._list.remove(key) |
561 except ValueError: | 560 except ValueError: |
562 pass | 561 pass |
562 return dict.pop(self, key, *args, **kwargs) | |
563 def keys(self): | 563 def keys(self): |
564 return self._list[:] | 564 return self._list[:] |
565 def iterkeys(self): | 565 def iterkeys(self): |
566 return self._list.__iter__() | 566 return self._list.__iter__() |
567 def iteritems(self): | 567 def iteritems(self): |