diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-09-24 13:56:33 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2009-09-24 13:56:33 -0400 |
commit | ddfd23a13ef444218bd1842b202743e321377de7 (patch) | |
tree | 42ef59d4cd55d59212c020b02fa850d0033bd207 | |
parent | 68988e4ad0eb1d0428a208633d4d0dea9e2c5db3 (diff) |
* sort by last name alphabetically
* replace (no own changesets) by (no information)
-rw-r--r-- | scripts/eigen_gen_credits.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
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<string,int> 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<contributor>& 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<contributor>::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++; } |