File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -102,16 +102,30 @@ def compress(years):
102102 print ("Years for each contributor..." )
103103 print ('' )
104104
105- # sort authors by last contribution date (newest first)
106105 def last_year (name ):
107- return sorted (list (names [name ]))[- 1 ]
106+ """Return year of the latest contribution for a given name"""
107+ return sorted (list (names [name ]))[- 1 ]
108+
109+ def first_year (name ):
110+ """Return year of the first contribution"""
111+ return sorted (list (names [name ]))[0 ]
112+
113+ def year_cmp (name1 , name2 ):
114+ """
115+ Year comparison function. First sort by latest contribution year (desc).
116+ If it matches, compare first contribution year (desc).
117+ """
118+ if last_year (name1 ) != last_year (name2 ):
119+ return last_year (name1 ) - last_year (name2 )
120+ else :
121+ return first_year (name1 ) - first_year (name2 )
108122
109- for author in sorted (list (names ), key = last_year , reverse = True ):
123+ for author in sorted (list (names ), cmp = year_cmp , reverse = True ):
110124 years = list (names [author ])
111125 yearstr = compress (years )
112126
113127 if 0 : #DEBUG
114128 print (years , yearstr , author )
115129 else :
116- print (yearstr , author )
130+ print ("Copyright (c) %s %s" % ( yearstr , author ) )
117131 print ('' )
You can’t perform that action at this time.
0 commit comments