]> git.sesse.net Git - vlc/blob - extras/misc/authors_list.sh
e592292b11c06b3e524fa5487034e0d8806de764
[vlc] / extras / misc / authors_list.sh
1 #!/bin/bash
2
3 # A script checking the git logs for commits. Final goal is updating AUTHORS.
4 # Run it in source root
5
6 # To be copied and run in the git directory for having "git shortlog -sn po/" find the logs.
7 # It will generate a subdirectory temp_update_AUTHORS
8
9
10 mkdir -p temp_update_AUTHORS
11
12 echo "Checking all git logs"
13 git shortlog -sn > temp_update_AUTHORS/all_git.txt
14
15 echo "Checking "po only" git logs"
16 git shortlog -sn po extras/package/win32/languages/ share/vlc.desktop.in > temp_update_AUTHORS/po_git.txt
17 # Now, not only po/ is checked. This way, translators are identified better and we save some lines in coders (some translators-only are removed)
18
19 echo "reading AUTHORS"
20 sed -n '/Programming/,/^$/  s/[^-].*/&/p' < AUTHORS | sed '1 d'  > temp_update_AUTHORS/programmers_part.txt
21 # The part of AUTHORS between Programming and the first empty line, without the ---- line
22
23
24 echo "Removing commit counts from git log"
25 sed 's/[0-9 \t]*\(.*\)/\1/g' < temp_update_AUTHORS/all_git.txt |sort|uniq > temp_update_AUTHORS/all_git_namesonly.txt
26 # I think "uniq" is not needed here.
27
28
29 echo "Removing translators from the git log"
30 # Remove translators. (Commiters with the same count in /po and total and hence are listed twice). Then the commit counter is removed
31 cat temp_update_AUTHORS/all_git.txt temp_update_AUTHORS/po_git.txt|sort|uniq -u |sed 's/[0-9 \t]*\(.*\)/\1/g' | sort|uniq> temp_update_AUTHORS/coders_only.txt
32
33
34 # Similar effect with second sed run:
35 # Remove translators. I remove every line containing the name. Maybe the .* before and after the last \1 should be removed (i.e. for contributors "Firstname Secondname aka something_you_want_to_keep"
36 #cat temp_update_AUTHORS/all_git.txt temp_update_AUTHORS/po_git.txt|sort|uniq -D|uniq|sed 's/[0-9 \t]*\(.*\)/\1/g' |sed 's:[0-9 \t]*\(.*\):s^.*\1.*^^g:' > temp_update_AUTHORS/remove_translators_gen
37 #
38 #sed -f temp_update_AUTHORS/remove_translators_gen < temp_update_AUTHORS/all_git_namesonly.txt > temp_update_AUTHORS/coders_only.txt
39 # This is everyone who did code commits with git. The blank lines are the removed translators.
40
41
42 # Now, I want to reduce the number of lines the human reader has to check, so we are going to kill the already listed contributors.
43
44 echo "Finding pre-git contributors in AUTHORS"
45 sed 's:\(.*\):s^.*\1.*^^g:' < temp_update_AUTHORS/coders_only.txt > temp_update_AUTHORS/remove_git_commiters_gen
46 sed -f temp_update_AUTHORS/remove_git_commiters_gen < temp_update_AUTHORS/programmers_part.txt |sort| uniq -u > temp_update_AUTHORS/pre-git.txt
47
48 sed 's:\(.*\):s^.*\1.*^^g:' < temp_update_AUTHORS/programmers_part.txt > temp_update_AUTHORS/remove_programmers_part_gen
49 sed -f temp_update_AUTHORS/remove_programmers_part_gen < temp_update_AUTHORS/coders_only.txt |sort| uniq -u > temp_update_AUTHORS/new_coders_only.txt
50
51 # VideoLAN as a contributor can be removed, I think
52
53
54
55 sed 's/[0-9 \t]*\(.*\)/\1/g' < temp_update_AUTHORS/all_git.txt  > temp_update_AUTHORS/all_git_namesonly_ordered.txt
56 # Just remove the tab an the # commits, keep the order. This file is going to be the sort order.
57 # You can re-order the complete programmers part like that and simply append the pre-git commiters.
58 # Ordering the contributors that way is not a bad idea.
59 # The question: Is it easier/better to check the new commiters in this order?
60 # One can find (UPPERCASE issues, middle names,..) better when listing them alphabetically.
61
62 # I suggest checking manually a file build like that:
63 # alphabetically ordered, complete list of contributors/git (code) commiters, with an extra marking for new ones. Example
64 # Old Commiter
65 # New Commiter           ---XXX---NEW
66 # New COMMITER           ---XXX---NEW   |same name with UPPERCASE part
67 # Very Commiter
68 # Very New Commiter      ---XXX---NEW   |Same person with a middle name
69
70 # The uppercase case can be done by script I guess, I did not look up how to make sure the intended version will be picked.
71 # How to proceed with manually found problems? Solve them for the future (.mailmap/own script/...)
72
73 rm -f temp_update_AUTHORS/ordering_log.txt
74 rm -f temp_update_AUTHORS/ordered_by_commits.txt 
75 FileName='temp_update_AUTHORS/all_git_namesonly_ordered.txt' 
76 while read LINE
77 do
78  if [ "$LINE" = "VideoLAN" ]; then
79   echo "VideoLAN is not a person"
80  else
81 #  grep "$LINE" temp_update_AUTHORS/new_coders_only.txt >> temp_update_AUTHORS/ordering_log.txt
82   grep "$LINE" temp_update_AUTHORS/coders_only.txt >> temp_update_AUTHORS/ordering_log.txt
83 # I want to keep the $? (it removes some broken names) but I could send the output to /dev/null
84 # If someone's name is a prefix to some other's name, this diff will show it:
85 # diff temp_update_AUTHORS/ordering_log.txt temp_update_AUTHORS/ordered_by_commits.txt
86 # AFAIK this will not effect the output, since we don't use the grep output but only the git output
87   if [ $? = "0" ]; then
88     echo "$LINE" >> temp_update_AUTHORS/ordered_by_commits.txt
89   fi
90  fi
91 done < $FileName
92
93
94
95 cat temp_update_AUTHORS/all_git.txt temp_update_AUTHORS/po_git.txt|sort|uniq -D|uniq|sed 's/[0-9 \t]*\(.*\)/\1/g' > temp_update_AUTHORS/translators.txt
96 wc -l temp_update_AUTHORS/*
97 echo "Some contributors only commited into po. Please cross-check that with the localization part. See: temp_update_AUTHORS/translators.txt"
98 echo "But first, please check if temp_update_AUTHORS/review.txt contains complete names and other constraints for publishing (i.e. UPPERCASE name parts, broken text, a name and it's abbreviation both present...)"
99
100
101 sed 's/\(.*\)/\1               ---XXX---NEW/g' < temp_update_AUTHORS/new_coders_only.txt | cat - temp_update_AUTHORS/programmers_part.txt |sort > temp_update_AUTHORS/review.txt
102 # This file contains VideoLAN as a contributor.
103
104 echo
105 echo "For the lazy ones: Have a look at temp_update_AUTHORS/final.txt"
106 echo "Contains all git code commiters (the translators are stored somewhere else) sorted by commits, and the pre-git commiters"
107 echo "Programming" >  temp_update_AUTHORS/final.txt
108 echo "-----------" >> temp_update_AUTHORS/final.txt
109 cat temp_update_AUTHORS/ordered_by_commits.txt temp_update_AUTHORS/pre-git.txt >> temp_update_AUTHORS/final.txt
110 echo
111
112 echo "Listing email adresses used with different names..."
113 git shortlog -sne |sed 's/[^<]*\(.*\)/\1/g' |sort|uniq -d
114 echo "If something was listed here you should probably modify .mailmap"
115
116 # This last part puts the relevant addresses into temp_twice_used_adress/check_for_this.txt
117 # Currently, this is not needed (.mailmap is up to date)
118
119 #mkdir -p temp_twice_used_adress
120 #echo "Checking all git logs"
121 #git shortlog -sne > temp_twice_used_adress/all_shortlog_sne.txt
122 #
123 #echo "Removing everything but email addresses"
124 #sed 's/[^<]*\(.*\)/\1/g' < temp_twice_used_adress/all_shortlog_sne.txt |sort|uniq -d > temp_twice_used_adress/all_git_addresses_only.txt
125 #
126 #FileName='temp_twice_used_adress/all_git_addresses_only.txt'
127 #while read LINE
128 #do
129 #  grep "$LINE" temp_twice_used_adress/all_shortlog_sne.txt >> temp_twice_used_adress/check_for_this.txt
130 ## I want to keep the $? (it removes some broken names) but I could send the output to /dev/null
131 #  if [ $? = "0" ]; then
132 #    echo "$LINE"
133 #  fi
134 #done < $FileName
135
136
137 cp temp_update_AUTHORS/final.txt .
138 rm -rf temp_update_AUTHORS/
139