[PATCH] [RFC] convert: fix --datesort

Matt Mackall mpm at selenic.com
Thu Dec 13 12:21:16 CST 2007


On Thu, Dec 13, 2007 at 08:41:48PM +0300, Kirill Smelkov wrote:
> # HG changeset patch
> # User Kirill Smelkov <kirr at mns.spb.ru>
> # Date 1197567565 -10800
> # Node ID 7a1570348d6df8f59289eddaee9452393033b078
> # Parent  eb2f94f6aeabff1638e0ad3c46fcbe80bf4e8fc2
> [RFC] convert: fix --datesort
> 
> The problem is that previously commit.date was used for sorting, but it's a
> string like "1 Jan xxx 2007", so it it wrong to use it for sorting.
> 
> Another problem is that why we are using depth for sorting -- I have no clear
> answer -- it seems to be plain wrong.
> 
> This patch is just an RFC.

Looks fine. I'll queue it without the comments.
 
> diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
> --- a/hgext/convert/convcmd.py
> +++ b/hgext/convert/convcmd.py
> @@ -145,9 +145,11 @@ class converter(object):
>                  if pl:
>                      depth[n] = max([depth[p] for p in pl]) + 1
>  
> -            s = [(depth[n], self.commitcache[n].date, n) for n in s]
> +#           s = [(depth[n], self.commitcache[n].date, n) for n in s]
> +            s = [(util.parsedate(self.commitcache[n].date), n) for n in s]
>              s.sort()
> -            s = [e[2] for e in s]
> +#           s = [e[2] for e in s]
> +            s = [e[1] for e in s]
>  
>          return s
-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list