Mercurial > kallithea
comparison scripts/update-copyrights.py @ 8310:d6ccf6a9fd11
scripts: fix crash from comparing integer with empty list
Fixed by using year 0 as default for contributors without any years.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sat, 28 Mar 2020 15:29:58 +0100 |
parents | 68bbfd164b23 |
children |
comparison
equal
deleted
inserted
replaced
8309:68bbfd164b23 | 8310:d6ccf6a9fd11 |
---|---|
50 * latest contribution | 50 * latest contribution |
51 * first contribution | 51 * first contribution |
52 * number of contribution years | 52 * number of contribution years |
53 * name (with some unicode normalization) | 53 * name (with some unicode normalization) |
54 The entries must be 2-tuples of a list of string years and the name""" | 54 The entries must be 2-tuples of a list of string years and the name""" |
55 return (x[0] and -int(x[0][-1]), | 55 years, name = x |
56 x[0] and int(x[0][0]), | 56 if not years: |
57 -len(x[0]), | 57 years = ['0'] |
58 x[1].decode('utf-8').lower().replace('\xe9', 'e').replace('\u0142', 'l') | 58 return (-int(years[-1]), # primarily sort by latest contribution |
59 int(years[0]), # then sort by first contribution | |
60 -len(years), # then sort by length of contribution (no gaps) | |
61 name.lower().replace('\xe9', 'e').replace('\u0142', 'l') # finally sort by name | |
59 ) | 62 ) |
60 | 63 |
61 | 64 |
62 def nice_years(l, dash='-', join=' '): | 65 def nice_years(l, dash='-', join=' '): |
63 """Convert a list of years into brief range like '1900-1901, 1921'.""" | 66 """Convert a list of years into brief range like '1900-1901, 1921'.""" |