[PATCH] sortdict: fix .pop() to return a value

Augie Fackler raf at durin42.com
Tue Apr 11 11:04:30 EDT 2017


On Sun, Apr 09, 2017 at 10:10:01PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1491706629 -32400
> #      Sun Apr 09 11:57:09 2017 +0900
> # Node ID 48a7a1f77a9489e3c4b5f862243782ceae80eaf9
> # Parent  9259cf823690e4fcd34a4d2ecd57ced2060d2b3d
> sortdict: fix .pop() to return a value

Queued, thanks

>
> My future patch will need it.
>
> diff --git a/mercurial/util.py b/mercurial/util.py
> --- a/mercurial/util.py
> +++ b/mercurial/util.py
> @@ -555,11 +555,11 @@ class sortdict(dict):
>          dict.__delitem__(self, key)
>          self._list.remove(key)
>      def pop(self, key, *args, **kwargs):
> -        dict.pop(self, key, *args, **kwargs)
>          try:
>              self._list.remove(key)
>          except ValueError:
>              pass
> +        return dict.pop(self, key, *args, **kwargs)
>      def keys(self):
>          return self._list[:]
>      def iterkeys(self):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list