From ddfd23a13ef444218bd1842b202743e321377de7 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 24 Sep 2009 13:56:33 -0400 Subject: * sort by last name alphabetically * replace (no own changesets) by (no information) --- scripts/eigen_gen_credits.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/eigen_gen_credits.cpp b/scripts/eigen_gen_credits.cpp index 7c1330ac6..7ffba8414 100644 --- a/scripts/eigen_gen_credits.cpp +++ b/scripts/eigen_gen_credits.cpp @@ -86,6 +86,15 @@ map contributors_map_from_churn_output(const char *filename) return contributors_map; } +// find the last name, i.e. the last word. +// for "van den Schbling" types of last names, that's not a problem, that's actually what we want. +string lastname(const string& name) +{ + size_t last_space = name.find_last_of(' '); + if(last_space >= name.length()-1) return name; + else return name.substr(last_space+1); +} + struct contributor { string name; @@ -98,7 +107,7 @@ struct contributor bool operator < (const contributor& other) { - return changedlines > other.changedlines; + return lastname(name).compare(lastname(other.name)) < 0; } }; @@ -155,11 +164,6 @@ void add_online_info_into_contributors_list(list& contributors_list } } -ostream& operator<<(ostream& stream, const contributor& c) -{ - stream << c.name << "|" << c.changedlines << "|" << c.changesets << "|" << c.url << "|" << c.misc; -} - int main() { // parse the hg churn output files @@ -185,7 +189,7 @@ int main() cout << "{| cellpadding=\"5\"\n"; cout << "!\n"; cout << "! Lines changed\n(changesets)\n"; - cout << "! Misc\n"; + cout << "!\n"; list::iterator itc; int i = 0; @@ -201,7 +205,7 @@ int main() if(itc->changedlines) cout << "| " << itc->changedlines << " (" << itc->changesets << ")\n"; else - cout << "| (no own changesets) \n"; + cout << "| (no information)\n"; cout << "| " << itc->misc << "\n"; i++; } -- cgit v1.2.3