Updated the output of the contributors list.

This commit is contained in:
Robert Osfield 2005-11-15 15:07:17 +00:00
parent 76f7f77883
commit 55ff399da5
2 changed files with 109 additions and 31 deletions

View File

@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs
CXXFILES =\ CXXFILES =\
osgversion.cpp\ osgversion.cpp\
LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) LIBS += -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)
INSTFILES = \ INSTFILES = \
$(CXXFILES)\ $(CXXFILES)\

View File

@ -8,11 +8,12 @@
#include <fstream> #include <fstream>
typedef std::pair<std::string, std::string> NamePair; typedef std::pair<std::string, std::string> NamePair;
typedef std::set<NamePair> NameSet; typedef std::map<NamePair,unsigned int> NameMap;
typedef std::vector< std::string > Words; typedef std::vector< std::string > Words;
NamePair EmptyNamePair; NamePair EmptyNamePair;
NamePair NameRobertOsfield("Robert","Osfield");
NamePair NameDonBurns("Don","Burns");
bool validName(const std::string& first) bool validName(const std::string& first)
{ {
@ -132,6 +133,7 @@ bool validName(const std::string& first)
if (first=="KeyboardMouse") return false; if (first=="KeyboardMouse") return false;
if (first=="KeyboardMouseCallback") return false; if (first=="KeyboardMouseCallback") return false;
if (first=="AutoTransform") return false; if (first=="AutoTransform") return false;
if (first=="AutoTransform.") return false;
if (first=="LightModel") return false; if (first=="LightModel") return false;
if (first=="MatrixManipulator") return false; if (first=="MatrixManipulator") return false;
if (first=="MatrixTransform") return false; if (first=="MatrixTransform") return false;
@ -337,9 +339,12 @@ NamePair createName(const std::string& first, const std::string& second)
if (last>0) if (last>0)
{ {
std::string surname(second.begin(), second.begin()+last); std::string surname(second.begin(), second.begin()+last);
surname = typoCorrection(surname);
if (validName(surname))
return NamePair(name, surname); {
surname = typoCorrection(surname);
return NamePair(name, surname);
}
} }
// filter any single or two letter words as unlike to be names. // filter any single or two letter words as unlike to be names.
@ -374,6 +379,12 @@ bool submissionsSequence(const Words& words, unsigned int& i)
return true; return true;
} }
if (words[i]=="Rolled" && words[i+1]=="in")
{
i+=1;
return true;
}
if (words[i]=="Checked" && words[i+1]=="in") if (words[i]=="Checked" && words[i+1]=="in")
{ {
i+=1; i+=1;
@ -391,7 +402,7 @@ bool submissionsSequence(const Words& words, unsigned int& i)
return false; return false;
} }
void readContributors(NameSet& names, const std::string& file) void readContributors(NameMap& names, const std::string& file)
{ {
std::ifstream fin(file.c_str()); std::ifstream fin(file.c_str());
@ -413,32 +424,45 @@ void readContributors(NameSet& names, const std::string& file)
{ {
NamePair name = createName(words[i+1], words[i+2]); NamePair name = createName(words[i+1], words[i+2]);
nameCorrection(name); nameCorrection(name);
if (!name.first.empty()) names.insert(name); if (!name.first.empty()) ++names[name];
i+=2; i+=2;
} }
else if (i+1<words.size() && validName(words[i+1])) else if (i+1<words.size() && validName(words[i+1]))
{ {
NamePair name = createName(words[i+1], blank_string); NamePair name = createName(words[i+1], blank_string);
nameCorrection(name); nameCorrection(name);
if (!name.first.empty()) names.insert(name); if (!name.first.empty()) ++names[name];
i+=1; i+=1;
} }
} }
else
{
if (words[i]=="robert")
{
++names[NameRobertOsfield];
}
else if (words[i]=="don")
{
++names[NameDonBurns];
}
}
} }
// reassign fisrt name entries to their full names entries
if (names.size()>1) if (names.size()>1)
{ {
for(NameSet::iterator itr = names.begin(); for(NameMap::iterator itr = names.begin();
itr != names.end(); itr != names.end();
) )
{ {
if (itr->second.empty()) if (itr->first.second.empty())
{ {
NameSet::iterator next_itr = itr; NameMap::iterator next_itr = itr;
++next_itr; ++next_itr;
if (next_itr!=names.end() && itr->first==next_itr->first) if (next_itr!=names.end() && itr->first.first==next_itr->first.first)
{ {
next_itr->second += itr->second;
names.erase(itr); names.erase(itr);
itr = next_itr; itr = next_itr;
} }
@ -453,20 +477,42 @@ void readContributors(NameSet& names, const std::string& file)
} }
} }
} }
// remove the double entries from Robert's contributions
if (names.size()>1)
{
for(NameMap::iterator itr = names.begin();
itr != names.end();
++itr)
{
if (itr->first != NameRobertOsfield && itr->first != NameDonBurns )
{
names[NameRobertOsfield] -= itr->second;
}
}
}
} }
void buildContributors(NameSet& names) void buildContributors(NameMap& names)
{ {
names.insert(NamePair("Robert","Osfield")); // top five contributors
names.insert(NamePair("Don","Burns")); ++names[NamePair("Robert","Osfield")];
names.insert(NamePair("Marco","Jez")); ++names[NamePair("Don","Burns")];
names.insert(NamePair("Karsten","Weiss")); ++names[NamePair("Marco","Jez")];
names.insert(NamePair("Graeme","Harkness")); ++names[NamePair("Mike","Weiblen")];
names.insert(NamePair("Axel","Volley")); ++names[NamePair("Geoff","Michael")];
names.insert(NamePair("Nikolaus","Hanekamp"));
names.insert(NamePair("Kristopher","Bixler")); // contributors that don't appear in the ChangeLog due to their contributions
names.insert(NamePair("Tanguy","Fautré")); // being before CVS started for the OSG, or before the name logging began.
names.insert(NamePair("J.E.","Hoffmann")); ++names[NamePair("Karsten","Weiss")];
++names[NamePair("Graeme","Harkness")];
++names[NamePair("Axel","Volley")];
++names[NamePair("Nikolaus","Hanekamp")];
++names[NamePair("Kristopher","Bixler")];
++names[NamePair("Tanguy","Fautré")];
++names[NamePair("J.E.","Hoffmann")];
} }
int main( int argc, char **argv) int main( int argc, char **argv)
@ -474,13 +520,18 @@ int main( int argc, char **argv)
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]"); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("-c or --contributors","Print out the contributors list."); arguments.getApplicationUsage()->addCommandLineOption("--entries","Print out number of entries into the ChangeLog file for each contributor.");
arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>","Read the changelog to generate an estimated contributors list."); arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>","Read the ChangeLog to generate an estimated contributors list.");
std::cout<<osgGetLibraryName()<< " "<< osgGetVersion()<<std::endl<<std::endl; std::cout<<osgGetLibraryName()<< " "<< osgGetVersion()<<std::endl<<std::endl;
bool printContributors = false; bool printContributors = false;
while ( arguments.read("-c") || arguments.read("--contributors")) printContributors = true; bool printNumEntries = false;
while ( arguments.read("--entries"))
{
printContributors = true;
printNumEntries = true;
}
std::string changeLog; std::string changeLog;
while ( arguments.read("-r",changeLog) || arguments.read("--read",changeLog)) printContributors = true; while ( arguments.read("-r",changeLog) || arguments.read("--read",changeLog)) printContributors = true;
@ -495,19 +546,46 @@ int main( int argc, char **argv)
if (printContributors) if (printContributors)
{ {
NameSet names; NameMap names;
buildContributors(names); buildContributors(names);
if (!changeLog.empty()) if (!changeLog.empty())
{ {
readContributors(names, changeLog); readContributors(names, changeLog);
} }
std::cout<<names.size()<<" Contributors:"<<std::endl<<std::endl; typedef std::multimap<unsigned int, NamePair> SortedNameMap;
for(NameSet::iterator itr = names.begin();
SortedNameMap sortedNames;
for(NameMap::iterator itr = names.begin();
itr != names.end(); itr != names.end();
++itr) ++itr)
{ {
std::cout<<" "<<itr->first<<" "<<itr->second<<std::endl; sortedNames.insert(SortedNameMap::value_type(itr->second, itr->first));
}
std::cout<<names.size()<<" Contributors:"<<std::endl<<std::endl;
if (printNumEntries)
{
std::cout<<"Entries Firstname Surname"<<std::endl;
std::cout<<"-------------------------"<<std::endl;
for(SortedNameMap::reverse_iterator sitr = sortedNames.rbegin();
sitr != sortedNames.rend();
++sitr)
{
std::cout<<sitr->first<<"\t"<<sitr->second.first<<" "<<sitr->second.second<<std::endl;
}
}
else
{
std::cout<<"Firstname Surname"<<std::endl;
std::cout<<"-----------------"<<std::endl;
for(SortedNameMap::reverse_iterator sitr = sortedNames.rbegin();
sitr != sortedNames.rend();
++sitr)
{
std::cout<<sitr->second.first<<" "<<sitr->second.second<<std::endl;
}
} }
} }