[PATCH 3 of 6] py3: implement __lt__() to make gitlfspointer sortable

Yuya Nishihara yuya at tcha.org
Sun Sep 30 08:08:10 EDT 2018


On Sun, 30 Sep 2018 01:46:22 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1538278134 14400
> #      Sat Sep 29 23:28:54 2018 -0400
> # Node ID 96752a0137b4b08677f3205362ece3c2e7fde057
> # Parent  1dd7c3dcfb46a39bc61419415c0818e0ed1bbd1c
> py3: implement __lt__() to make gitlfspointer sortable
> 
> diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py
> --- a/hgext/lfs/pointer.py
> +++ b/hgext/lfs/pointer.py
> @@ -30,6 +30,9 @@ class gitlfspointer(dict):
>          super(gitlfspointer, self).__init__(*args)
>          self.update(pycompat.byteskwargs(kwargs))
>  
> +    def __lt__(self, other):
> +        return self.oid() < other.oid()

I don't think it's correct to implement only __lt__(). Perhaps, easier
workaround is to use sorted(..., key=lambda...) instead.

Queued the other patches, thanks.


More information about the Mercurial-devel mailing list