0%

GINQ应用之Git统计

概述

GINQ是Groovy 4主要新特性之一,在之前的《Groovy 4之新特性GINQ预览》中已经介绍过其原理和用法。而本文将通过一个Groovy脚本来展示GINQ在实战中的应用。

脚本功能及原理

统计Git仓库中每个贡献者的提交情况,处理过程如下:

  • 通过Git命令生成Git log文件
  • 通过Regex对Git log文件内容进行解析
  • 通过GINQ对解析后的数据进行统计

脚本中GINQ应用摘要

以email作为分组条件,统计每个贡献者的commit数量、文件数量、代码添加行数、代码删除行数,最后按照commit数量降序、贡献者名字升序进行排序

def result = GQ {
from c in commitInfoList
groupby c.email
orderby count() in desc, max(c.author)
select max(c.author) as author, c.email, count() as sumCommits, sum(c.fileChanged) as sumFilesChanged, sum(c.insertions) as sumInsertions, sum(c.deletions) as sumDeletions
}

print result

统计结果示例:Apache Groovy项目

注:该统计结果截止到2024年6月2日


+---------------------------------+---------------------------------------+------------+-----------------+---------------+--------------+
| author | email | sumCommits | sumFilesChanged | sumInsertions | sumDeletions |
+---------------------------------+---------------------------------------+------------+-----------------+---------------+--------------+
| paulk-asert | paulk@asert.com.au | 5449 | 23763 | 411512 | 382831 |
| sunlan | sunlan@apache.org | 2277 | 7345 | 196842 | 62597 |
| Jochen Theodorou | blackdrag@gmx.org | 1662 | 4138 | 96950 | 58303 |
| Cedric Champeau | cedric.champeau@gmail.com | 1616 | 8515 | 193314 | 75953 |
| Eric Milles | eric.milles@thomsonreuters.com | 1467 | 4307 | 159350 | 129709 |
| James Strachan | jastrachan@mac.com | 1024 | 6027 | 186845 | 115967 |
| Guillaume Laforge | glaforge@gmail.com | 708 | 2256 | 56188 | 32206 |
| pascalschumacher | pascalschumacher@gmx.net | 614 | 1765 | 13293 | 20000 |
| Roshan Dawrani | roshandawrani@gmail.com | 310 | 688 | 11074 | 1730 |
| Jason Dillon | jason.dillon@gmail.com | 305 | 824 | 15545 | 7863 |
| Danno Ferrin | danno.ferrin@shemnon.com | 301 | 1183 | 36094 | 15206 |
| Alex Tkachman | alex.tkachman@gmail.com | 284 | 3405 | 278612 | 21153 |
| John Wilson | tug@wilson.co.uk | 230 | 605 | 22793 | 13472 |
| John Wagenleitner | jwagenleitner@apache.org | 185 | 592 | 12495 | 5909 |
| danielsun1106 | realbluesun@hotmail.com | 176 | 354 | 7376 | 1833 |
| Jeremy Rayner | jeremy.rayner@gmail.com | 158 | 654 | 46619 | 21760 |
| Cedric Champeau | cchampeau@apache.org | 156 | 1398 | 11480 | 7512 |
| Thibault Kruse | kruset@in.tum.de | 134 | 616 | 11882 | 5425 |
| Russel Winder | russel@russel.org.uk | 132 | 287 | 9058 | 19868 |
| Dierk Koenig | dierk.koenig@canoo.com | 116 | 392 | 9716 | 2430 |
| aalmiray | aalmiray@gmail.com | 104 | 245 | 9580 | 1159 |
| Pilho Kim | phkim@cluecom.co.kr | 103 | 325 | 10676 | 3231 |
| Sam Pullara | sam@sampullara.com | 99 | 251 | 6164 | 3369 |
| Seagull | xSeagullx@gmail.com | 86 | 322 | 5745 | 1535 |
| Boc McWhirter | bob@codehaus.org | 79 | 237 | 4054 | 1209 |
| Graeme Rocher | grocher@vmware.com | 67 | 2088 | 6833 | 228960 |
| Andre Steingress | me@andresteingress.com | 65 | 414 | 21365 | 3123 |
| Jim White | jim@pagesmiths.com | 63 | 121 | 2382 | 552 |
| Peter Niederwieser | pniederw@gmail.com | 56 | 205 | 5067 | 2446 |
| Andrey Bloschetsov | bloschetsov@gmail.com | 50 | 137 | 8110 | 927 |
| Christian Stein | sormuras@gmx.de | 49 | 150 | 4554 | 2306 |
| Martin C. Martin | martin@martincmartin.com | 49 | 77 | 1105 | 670 |
| Remko Popma | remkop@yahoo.com | 42 | 68 | 4369 | 654 |
| peter | peter@jetbrains.com | 42 | 115 | 2410 | 664 |
| Thibault Kruse | thibault.kruse@gmx.de | 40 | 95 | 1723 | 1003 |
| Marc Guillemot | mguillemot@yahoo.fr | 38 | 401 | 2254 | 1133 |
| Zongle Wang | wangzongler@gmail.com | 36 | 177 | 687 | 686 |
| Shil Sinha | shils@apache.org | 35 | 66 | 942 | 210 |
| Keegan Witt | keeganwitt@gmail.com | 34 | 87 | 1365 | 777 |
| Shil Sinha | shil.sinha@gmail.com | 32 | 79 | 1315 | 138 |
| Tim Yates | tyates@picr.man.ac.uk | 29 | 50 | 1432 | 326 |
| Chris Poirier | cpoirier@gmail.com | 28 | 164 | 17483 | 8169 |
| John Wagenleitner | john.wagenleitner@gmail.com | 28 | 63 | 1568 | 1106 |
| Jim White | james.paul.white@gmail.com | 27 | 68 | 1289 | 233 |
| Joachim Baumann | joachim.baumann@xinaris.de | 27 | 41 | 801 | 137 |
| Alexandru Popescu | alexander.popescu@gmail.com | 24 | 47 | 1454 | 252 |
| Yu Kobayashi | yukoba@accelart.jp | 24 | 55 | 4392 | 270 |
| Martin Kempf | mkempf@hsr.ch | 22 | 50 | 1844 | 458 |
| Bing Ran | bran@ccniit.com | 21 | 102 | 9197 | 568 |
| Bo Zhang | zhangbodut@gmail.com | 21 | 78 | 389 | 282 |
| Sergey Egorov | bsideup@gmail.com | 21 | 71 | 2375 | 1233 |
| Alan Green | alan.green@cardboard.nu | 20 | 31 | 894 | 429 |
| Thom Nichols | tmnichols@gmail.com | 19 | 39 | 1221 | 391 |
| Frank Pavageau | fpavageau@ekino.com | 17 | 39 | 777 | 201 |
| Guillaume Alleon | guillaume.alleon@gmail.com | 16 | 25 | 1050 | 279 |
| Esko Toivonen | esko.toivonen@tuni.fi | 13 | 22 | 448 | 93 |
| Jeff Brown | jeff@jeffandbetsy.net | 13 | 19 | 360 | 43 |
| Steve Goetze | goetze@dovetail.com | 13 | 51 | 764 | 242 |
| javaboon | richard.m.hightower@gmail.com | 13 | 142 | 11864 | 3307 |
| kruset | tibokruse@googlemail.com | 13 | 17 | 128 | 85 |
| Marc Wrobel | marc.wrobel@gmail.com | 12 | 269 | 875 | 872 |
| Paolo Di Tommaso | paolo.ditommaso@gmail.com | 12 | 27 | 2774 | 199 |
| Peter Ledbrook | peter@cacoethes.co.uk | 12 | 13 | 220 | 25 |
| graemerocher | graeme.rocher@gmail.com | 12 | 23 | 881 | 218 |
| jnorthr | james.b.northrop@googlemail.com | 11 | 60 | 2483 | 44 |
| John Stump | johnstump2@yahoo.com | 10 | 18 | 397 | 27 |
| Kenneth Endfinger | kaendfinger@gmail.com | 10 | 13 | 20 | 18 |
| mattisonchao | mattisonchao@gmail.com | 10 | 83 | 363 | 548 |
| Bertrand Delacretaz | bdelacretaz@apache.org | 9 | 10 | 272 | 50 |
| Christoph Frick | rid@ofnir.net | 9 | 10 | 34 | 14 |
| Craig Andrews | candrews@integralblue.com | 9 | 15 | 362 | 121 |
| Marcin Erdmann | erdi84@gmail.com | 9 | 43 | 689 | 132 |
| Michael Schuenck | michaelss@gmail.com | 9 | 15 | 428 | 108 |
| Tomek Janiszewski | janiszt@gmail.com | 9 | 19 | 97 | 73 |
| Jacopo Cappellato | jacopo.cappellato@gmail.com | 8 | 9 | 118 | 200 |
| John Rose | john.r.rose@oracle.com | 8 | 24 | 8999 | 8371 |
| Larry Jacobson | 4larryj@gmail.com | 8 | 14 | 150 | 48 |
| Martin Hauner | martin.hauner@gmx.net | 8 | 13 | 280 | 77 |
| Matias Bjarland | matias@iteego.com | 8 | 18 | 2590 | 206 |
| Sergei Egorov | sergei.egorov@zeroturnaround.com | 8 | 43 | 1546 | 682 |
| Tobia Conforto | tobia.conforto@gmail.com | 8 | 17 | 161 | 145 |
| Zohar Melamed | zohar.melamed@gmail.com | 8 | 9 | 204 | 185 |
| zhangbo | zhangbo@nanchao.org | 8 | 12 | 518 | 198 |
| Aseem Bansal | anshbansal@users.noreply.github.com | 7 | 7 | 12 | 6 |
| Hein Meling | hein.meling@uis.no | 7 | 16 | 136 | 26 |
| Iiro Kiviluoma | iirokiviluoma@outlook.com | 7 | 12 | 208 | 74 |
| JBrownVisualSpection | jbrown@visualspection.com | 7 | 7 | 8 | 8 |
| jameskleeh | james.kleeh@gmail.com | 7 | 26 | 236 | 51 |
| Alex Golub | a12thu@gmail.com | 6 | 8 | 68 | 61 |
| Andrew Taylor | ataylor@redtoad.ca | 6 | 14 | 572 | 6 |
| Eerik Voimanen | eerik.voimanen@tuni.fi | 6 | 7 | 96 | 49 |
| Jake Gage | jake.gage@gmail.com | 6 | 16 | 224 | 13 |
| Scott Stirling | scottstirling@gmail.com | 6 | 8 | 1049 | 982 |
| Thibault Kruse | thibault.kruse@comsysto.com | 6 | 13 | 248 | 85 |
| Yasuharu Nakano | ynak@jggug.org | 6 | 14 | 508 | 521 |
| rusty | russellsanborn@gmail.com | 6 | 8 | 158 | 150 |
| Adrian Nistor | nistor1@illinois.edu | 5 | 5 | 11 | 7 |
| Andrew Eisenberg | aeisenberg@vmware.com | 5 | 8 | 64 | 15 |
| Aseem Bansal | aseembansal@live.com | 5 | 6 | 17 | 13 |
| Esteban | eginez@gmail.com | 5 | 10 | 200 | 20 |
| Franck Rasolo | franck.rasolo@gmail.com | 5 | 13 | 229 | 163 |
| Jeff Scott Brown | jbrown@gopivotal.com | 5 | 6 | 9 | 8 |
| Joe Wolf | joewolf@gmail.com | 5 | 26 | 4665 | 167 |
| Kent | kifs@hib.no | 5 | 15 | 624 | 48 |
| Kirill Vlasov | kirill.vlasov@devfactory.com | 5 | 59 | 95 | 99 |
| Marc Paquette | marcpa@mac.com | 5 | 6 | 204 | 6 |
| Masato Nagai | me@masatonagai.com | 5 | 15 | 265 | 45 |
| MoonFruit | dkmoonfruit@gmail.com | 5 | 8 | 143 | 20 |
| Sam Harwell | sam@tunnelvisionlabs.com | 5 | 5 | 23 | 17 |
| Sandip Chitale | sandipchitale@gmail.com | 5 | 7 | 250 | 39 |
| Sargis Harutyunyan | sargis@webbfontaine.am | 5 | 8 | 162 | 53 |
| alexey.afanasiev | Alexey.Afanasiev@jetbrains.com | 5 | 10 | 362 | 11 |
| jbaruch | jbaruch@jfrog.com | 5 | 6 | 88 | 24 |
| musketyr | vladimir@orany.cz | 5 | 8 | 337 | 16 |
| Andrew Hamilton | andrew.hamil10@gmail.com | 4 | 5 | 43 | 44 |
| Baruch Sadogursky | jbaruchs@gmail.com | 4 | 4 | 51 | 6 |
| Damage Control | support@codehaus.org | 4 | 4 | 4 | 4 |
| Davyd Kohut | expexes@gmail.com | 4 | 8 | 229 | 133 |
| Hubert Klein Ikkink | h.kleinikkink@gmail.com | 4 | 27 | 797 | 46 |
| James Laverack | james@jameslaverack.com | 4 | 5 | 26 | 17 |
| Jan Lukavsky | je.ik@seznam.cz | 4 | 9 | 48 | 25 |
| Jason Schindler | schindlerj@objectcomputing.com | 4 | 4 | 72 | 5 |
| Jason Winnebeck | gillius@gillius.org | 4 | 4 | 22 | 9 |
| Jochen Kemnade | jochen.kemnade@eddyson.de | 4 | 7 | 66 | 3 |
| Lari Hotari | lhotari@gopivotal.com | 4 | 4 | 50 | 26 |
| Maksym Stavytskyi | stavytskyi@gmail.com | 4 | 8 | 219 | 12 |
| Michal Kordas | kordas.michal@gmail.com | 4 | 14 | 20 | 20 |
| Sean Gilligan | sean@msgilligan.com | 4 | 4 | 30 | 3 |
| Simon Tost | simon.tost@tngtech.com | 4 | 6 | 271 | 63 |
| Stephane Talbot | Stephane.Talbot@univ-savoie.fr | 4 | 19 | 268 | 7 |
| UEHARA Junji | uehaj@jggug.org | 4 | 4 | 48 | 5 |
| Vladimir Vivien | vladimir.vivien@gmail.com | 4 | 55 | 6520 | 1137 |
| antoaravinth | anto.aravinth.cse@gmail.com | 4 | 9 | 222 | 3 |
| j | kimchichef@users.noreply.github.com | 4 | 4 | 4 | 4 |
| timyates | tim.yates@gmail.com | 4 | 6 | 24 | 6 |
| Andrew Eisenberg | andrew@eisenberg.as | 3 | 8 | 345 | 35 |
| Bloshchetsov Andrey Evgenyevich | a.bloshchetsov@tcsbank.ru | 3 | 3 | 279 | 156 |
| Chris Earle | chris.earle@elasticsearch.com | 3 | 7 | 46 | 8 |
| Christiaan ten Klooster | ckl@dacelo.nl | 3 | 6 | 235 | 7 |
| Jacob Aae Mikkelsen | github@grydeske.dk | 3 | 7 | 55 | 3 |
| Johannes Link | business@johanneslink.net | 3 | 31 | 3622 | 15 |
| Jorge | jagedn@gmail.com | 3 | 3 | 24 | 25 |
| Luke Daley | ld@ldaley.com | 3 | 18 | 110 | 10 |
| Luke Kirby | luke@kirbylovell.com | 3 | 5 | 145 | 10 |
| Mariusz Wasak | mawasak@gmail.com | 3 | 4 | 57 | 5 |
| Michael Kutz | michael.kutz@rewe-digital.com | 3 | 3 | 3 | 3 |
| Otto Vayrynen | otto.vayrynen@tuni.fi | 3 | 6 | 36 | 11 |
| Rich Freedman | richfreedman@gmail.com | 3 | 3 | 0 | 3 |
| Richard Hightower | richardhightower@gmail.com | 3 | 32 | 1006 | 1043 |
| Stephane Maldini | smaldini@doc4web.com | 3 | 5 | 79 | 4 |
| anto_belgin | anto_belgin@blrjpt251d.ad.infosys.com | 3 | 6 | 350 | 22 |
| dkhamitov | khamitov.dm@gmail.com | 3 | 18 | 339 | 105 |
| energister | energister@users.noreply.github.com | 3 | 3 | 9 | 8 |
| fmamud | trovatti@gmail.com | 3 | 4 | 11 | 2 |
| hbaykuslar | hakanbaykuslar@gmail.com | 3 | 6 | 11 | 6 |
| rive | zhang1369077810@sina.com | 3 | 3 | 5 | 5 |
| shalecraig | shalecraig@gmail.com | 3 | 3 | 11 | 3 |
| AarjavP | AarjavP@users.noreply.github.com | 2 | 2 | 2 | 2 |
| Anand upadhyay | anand.upadhyay.consultant@nielsen.com | 2 | 3 | 22 | 1 |
| Andrew Reitz | aj.reitz@gmail.com | 2 | 2 | 6 | 6 |
| Arsen Babakhanyan | arsen.ba@gmail.com | 2 | 2 | 14 | 12 |
| Bobby Warner | bobbywarner@gmail.com | 2 | 4 | 61 | 32 |
| Christoph Frick | cf@ofnir.net | 2 | 4 | 156 | 3 |
| Damir Murat | damir.murat.git@gmail.com | 2 | 4 | 254 | 4 |
| Dan Allen | dan.j.allen@gmail.com | 2 | 2 | 28 | 19 |
| Dario Arena | dario.arena87@gmail.com | 2 | 2 | 177 | 657 |
| Dimitry Polivaev | dpolivaev@gmx.de | 2 | 9 | 424 | 17 |
| Dominik Przybysz | dpr@touk.pl | 2 | 6 | 237 | 1 |
| Edgar Rios Navarro | edgar.gs@gmail.com | 2 | 2 | 16 | 16 |
| Gvaneyck | gvaneyck@riotgames.com | 2 | 3 | 83 | 70 |
| Jan Sykora | jsykora@vendavo.com | 2 | 4 | 13 | 6 |
| Jeff Sheets | jeffsheets@gmail.com | 2 | 3 | 249 | 42 |
| John Hurst | john.b.hurst@gmail.com | 2 | 18 | 598 | 30 |
| John Tompkins | tompkins.jt@gmail.com | 2 | 11 | 22 | 25 |
| Kamil Szymanski | kamil.szymanski.dev@gmail.com | 2 | 10 | 17 | 17 |
| Karsten Tinnefeld | k.tinnefeld@gmail.com | 2 | 3 | 11 | 4 |
| Kasper Nielsen | kasper@codehaus.org | 2 | 3 | 232 | 27 |
| Kenyon Ralph | quic_kralph@quicinc.com | 2 | 5 | 13 | 13 |
| Kishore Kumar M V | kishorekumar@huawei.com | 2 | 2 | 4 | 3 |
| Konstantin Yegupov | kyegupov4@gmail.com | 2 | 2 | 3 | 1 |
| Larry Battle | larry.battle.tech@gmail.com | 2 | 2 | 2 | 1 |
| Marc Bogaerts | marcbogaerts@telenet.be | 2 | 6 | 137 | 8 |
| Marcus Berndt | marcus.berndt@data-experts.de | 2 | 2 | 49 | 37 |
| Mario Garcia | mario.ggar@gmail.com | 2 | 16 | 2125 | 4 |
| Martin Stockhammer | m.stockhammer@web.de | 2 | 2 | 110 | 1 |
| Matyrobbrt | matyrobbrt@gmail.com | 2 | 5 | 87 | 22 |
| Nelson Osacky | nosacky@gradle.com | 2 | 4 | 35 | 8 |
| Nick Grealy | nickgrealy@gmail.com | 2 | 18 | 288 | 15 |
| Nicolas Vuillamy | nicolas.vuillamy@gmail.com | 2 | 2 | 3 | 3 |
| Pierre-Nicolas Clauss | pinicarus@protonmail.com | 2 | 2 | 3 | 3 |
| Rahul Somasunderam | rahul.som@gmail.com | 2 | 4 | 39 | 26 |
| Ruben Laguna | ruben.laguna@gmail.com | 2 | 4 | 201 | 10 |
| Sargis Harutyunyan | sargis.harutyunyan@webbfontaine.com | 2 | 4 | 72 | 1 |
| Sargis Harutyunyan | armsargis@gmail.com | 2 | 3 | 35 | 3 |
| Sergio Delgado | sdelgado@gradle.com | 2 | 13 | 87 | 99 |
| Stephen Magill | stephen.magill@gmail.com | 2 | 2 | 39 | 0 |
| Thomas Reifenberger | tom-mi@users.noreply.github.com | 2 | 3 | 119 | 0 |
| Tiago Fernandez | tiago.fernandez@gmail.com | 2 | 4 | 79 | 36 |
| VasylTretiakov | vasyl.tretiakov@gmail.com | 2 | 2 | 3 | 3 |
| Yuri Schimke | yuri.schimke@gmail.com | 2 | 13 | 300 | 93 |
| davydotcom | davydotcom@gmail.com | 2 | 2 | 43 | 10 |
| gyd_lhw | 834921748@qq.com | 2 | 3 | 95 | 1 |
| hdfg159 | hdfg159@126.com | 2 | 5 | 56 | 35 |
| qxo | qxodream@gmail.com | 2 | 2 | 3 | 2 |
| saschaklein | info@aklein.org | 2 | 2 | 31 | 18 |
| seanjreilly | seanjreilly@gmail.com | 2 | 3 | 3 | 3 |
| suoyi123wang | 1512721306@qq.com | 2 | 2 | 36 | 4 |
| tttao | bigtao@gmail.com | 2 | 5 | 175 | 90 |
| upcrob | rupcraft@gmail.com | 2 | 2 | 4 | 5 |
| yuhengfdada | 877751954@qq.com | 2 | 3 | 35 | 2 |
| Abraham Grief | abraham.grief@gmail.com | 1 | 3 | 57 | 67 |
| Adam Davis | ada.m.d.a.v@gmail.com | 1 | 4 | 29 | 2 |
| Adam Lewandowski | adam.lewandowski@plxis.com | 1 | 1 | 2 | 1 |
| Adithyan K | adi.k.dev@gmail.com | 1 | 2 | 850 | 0 |
| Adrian Nistor | user@codehaus.org | 1 | 7 | 9 | 0 |
| Alan Thompson | thompson2526@gmail.com | 1 | 3 | 17 | 3 |
| Alar Aule | alar.aule@smit.ee | 1 | 3 | 139 | 6 |
| Alberto Ingenito | alberto.ing@gmail.com | 1 | 1 | 14 | 5 |
| Aleksei | egorov.aleksey@gmail.com | 1 | 1 | 1 | 1 |
| Alessio Stalla | alessiostalla@gmail.com | 1 | 1 | 8 | 2 |
| Alex Sherwin | alex-sherwin@users.noreply.github.com | 1 | 1 | 1 | 1 |
| Alex Spurling | alexspurling@gmail.com | 1 | 1 | 2 | 6 |
| Alexander Stohr | alexander.stohr@gmx.de | 1 | 1 | 2 | 2 |
| Alykoff | galll-al@yandex.kz | 1 | 1 | 1 | 1 |
| Amir Naghibi | amir.naghibi@visier.com | 1 | 4 | 4 | 4 |
| Anders D. Johnson | adjohnson916@users.noreply.github.com | 1 | 1 | 3 | 3 |
| Anders Wallgren | awallgren@cloudbees.com | 1 | 2 | 33 | 6 |
| Andrej Balles | netzbewohner@gmail.com | 1 | 1 | 1 | 1 |
| Andrej Vano | avano@redhat.com | 1 | 1 | 2 | 2 |
| Andres Almiray | andres@gradle.com | 1 | 3 | 50 | 3 |
| Andrew Bayer | andrew.bayer@gmail.com | 1 | 1 | 4 | 0 |
| Andrew Reitz | andrew.reitz@smartthings.com | 1 | 1 | 1 | 1 |
| Andrey Bozhko | andybozhko@gmail.com | 1 | 1 | 2 | 2 |
| Andy Hamilton | andyh@slalom.com | 1 | 1 | 9 | 0 |
| Andy Wilkinson | awilkinson@pivotal.io | 1 | 2 | 36 | 1 |
| Antoine Kapps | antoine.kapps@zas.admin.ch | 1 | 2 | 9 | 6 |
| Antoine Kapps | antoine.kapps@orange.fr | 1 | 2 | 55 | 2 |
| Arthur Milchior | arthur@milchior.fr | 1 | 1 | 1 | 1 |
| Aslak Hellesoy | aslak.hellesoy@gmail.com | 1 | 2 | 10 | 4 |
| Axel | axmf@users.noreply.github.com | 1 | 1 | 1 | 1 |
| Bartlomiej Stefanski | bst@touk.pl | 1 | 1 | 1 | 1 |
| Benjamin Graf | benjamin.graf@gmx.net | 1 | 1 | 11 | 0 |
| Benjamin Porter | FreedomBen@users.noreply.github.com | 1 | 3 | 3 | 3 |
| Benjamin Roe | benjamin.roe@cirrus.com | 1 | 3 | 35 | 14 |
| Bin Wang | binwang.developer@outlook.com | 1 | 1 | 1 | 1 |
| Brad Beck | bradley.beck@gmail.com | 1 | 1 | 1 | 2 |
| Bruno Casali | brunoocasali@gmail.com | 1 | 1 | 1 | 1 |
| Carsten Lenz | carsten.lenz@aoe.com | 1 | 2 | 39 | 17 |
| Cheryl Hughey | cherylhughey@hotmail.com | 1 | 1 | 1 | 1 |
| Christopher Smith | chrylis@gmail.com | 1 | 1 | 4 | 3 |
| Clay Johnson | cjohnson@gradle.com | 1 | 12 | 59 | 186 |
| Colin Harrington | colin.harrington@gmail.com | 1 | 2 | 5 | 2 |
| Colm O hEigeartaigh | coheigea@apache.org | 1 | 1 | 1 | 0 |
| DJBen | lsh32768@gmail.com | 1 | 4 | 64 | 0 |
| Daniel Spilker | daniel.spilker@coremedia.com | 1 | 2 | 26 | 3 |
| Daniel Spilker | mail@daniel-spilker.com | 1 | 2 | 26 | 4 |
| Daniil Ovchinnikov | daniil.ovchinnikov@jetbrains.com | 1 | 2 | 18 | 1 |
| Dariusz Kobylarz | darek.kobylarz@gmail.com | 1 | 1 | 78 | 6 |
| David Avenante | altus34@gmail.com | 1 | 1 | 1 | 1 |
| David Eisner | deisner@gmail.com | 1 | 1 | 2 | 2 |
| David Nahodil | dnahodil@utas.edu.au | 1 | 1 | 3 | 2 |
| David Pursehouse | david.pursehouse@gmail.com | 1 | 1 | 1 | 1 |
| David Tiselius | david.tiselius@gmail.com | 1 | 1 | 1 | 1 |
| Dean Brettle | dean@brettle.com | 1 | 1 | 2 | 2 |
| Dimitar Dimitrov | ddimitrov@github | 1 | 2 | 78 | 0 |
| Dipanjan Bhowmik | dipanjan.bhowmik@lexmark.com | 1 | 2 | 73 | 1 |
| Dirk Weber | Dirk.Weber1@gmx.de | 1 | 2 | 24 | 0 |
| Dmitry | devbyside@gmail.com | 1 | 1 | 3 | 3 |
| Dmitry Andreychuk | and.dmitry@gmail.com | 1 | 2 | 27 | 0 |
| Dominik Fay | dominik.fay@gmx.de | 1 | 1 | 1 | 1 |
| Dominik Fay | DarthPumpkin@users.noreply.github.com | 1 | 1 | 1 | 1 |
| Dylan Cali | calid1984@gmail.com | 1 | 8 | 105 | 122 |
| Emilian Bold | emi@apache.org | 1 | 6 | 170 | 2 |
| Emmanuel Bourg | ebourg@apache.org | 1 | 6 | 10 | 4 |
| Eric Dahl | eric.c.dahl@gmail.com | 1 | 1 | 3 | 3 |
| Eric Helgeson | eric@sproutary.com | 1 | 1 | 66 | 0 |
| Erich Schubert | kno10@users.noreply.github.com | 1 | 1 | 1 | 1 |
| Eugene Kliuchnikov | eustas.ru@gmail.com | 1 | 1 | 1 | 1 |
| Fabio de Matos | fdematos@despegar.com | 1 | 2 | 31 | 15 |
| Fiouz | fiouzy@gmail.com | 1 | 2 | 47 | 0 |
| Gary Clayburg | gclaybur@comcast.net | 1 | 2 | 33 | 9 |
| Geoffrey Alexandre | pygmyalex@gmail.com | 1 | 1 | 1 | 1 |
| Grant McConnaughey | grantmcconnaughey@gmail.com | 1 | 2 | 412 | 16 |
| Harsh Gupta | harshgupta1992@hotmail.com | 1 | 4 | 5 | 5 |
| Henrique Mota | henriquebrasileiro@zgsolucoes.com.br | 1 | 3 | 115 | 62 |
| Hugues Lerebours | h.lerebours@criteo.com | 1 | 3 | 17 | 14 |
| Ingo Hoffmann | Ingo@Hoffmann.cx | 1 | 5 | 28 | 9 |
| JBaruch | jbaruch@sadogursky.com | 1 | 2 | 33 | 0 |
| Jacob Aae Mikkelsen | jam@nineconsult.dk | 1 | 1 | 1 | 1 |
| Jacob Aae Mikkelsen | jam@cardlay.com | 1 | 2 | 42 | 1 |
| Jakub Wilk | jwilk@jwilk.net | 1 | 1 | 1 | 1 |
| James Williams | james.l.williams@gmail.com | 1 | 1 | 2 | 2 |
| Jamie Echlin | jechlin@adaptavist.com | 1 | 1 | 22 | 0 |
| Jan | janmonterrubio@gmail.com | 1 | 1 | 1 | 1 |
| Jason Plurad | pluradj@apache.org | 1 | 1 | 9 | 1 |
| Jason Schindler | jason@types.codes | 1 | 2 | 35 | 5 |
| Jeffrey Adamson | jwadamson@us.ibm.com | 1 | 1 | 10 | 10 |
| Jenn Strater | jenn.strater@gmail.com | 1 | 8 | 23 | 23 |
| Jennifer Strater | jennifer.strater@zenjob.com | 1 | 1 | 1 | 1 |
| Jess Sightler | jesse.sightler@gmail.com | 1 | 1 | 4 | 0 |
| Jesse Glick | jglick@cloudbees.com | 1 | 4 | 79 | 1 |
| Jesse Glick | jglick@apache.org | 1 | 3 | 43 | 1 |
| Jochen Berger | fooberger@gmail.com | 1 | 1 | 10 | 0 |
| John Engelman | john.r.engelman@gmail.com | 1 | 1 | 14 | 4 |
| John Engelman | john.engelman@target.com | 1 | 2 | 11 | 3 |
| John J. Allison | jja@sinequanon.net | 1 | 1 | 2 | 2 |
| John Mercier | moaxcp@gmail.com | 1 | 3 | 33 | 1 |
| Johnny Wey | johnnywey@gmail.com | 1 | 1 | 9 | 6 |
| Jon Schneider | jkschneider@gmail.com | 1 | 1 | 25 | 18 |
| Jonatas Emidio | jonatasemidio@gmail.com | 1 | 1 | 12 | 0 |
| Joona | joona.makipernaa@gmail.com | 1 | 1 | 18 | 0 |
| Jose M. Alonso M | josemalonsom@yahoo.es | 1 | 1 | 1 | 1 |
| JuanDavi Evora Hanggi | jdevora@users.noreply.github.com | 1 | 1 | 2 | 2 |
| Justin Chu | justinchuch@gmail.com | 1 | 2 | 68 | 1 |
| Kamil Jedrzejuk | kamil.jedrzejuk@gmail.com | 1 | 1 | 4 | 1 |
| Karel Piwko | kpiwko@redhat.com | 1 | 1 | 1 | 1 |
| Keith Suderman | suderman@cs.vassar.edu | 1 | 1 | 2 | 4 |
| Ken Geis | geis.ken@gmail.com | 1 | 1 | 2 | 2 |
| Kenneth Kousen | ken.kousen@kousenit.com | 1 | 2 | 10 | 2 |
| Kohsuke Kawaguchi | kk@kohsuke.org | 1 | 3 | 183 | 0 |
| Kris Marwood | kris@krismarwood.com | 1 | 1 | 1 | 1 |
| Lari Hotari | lari.hotari@sagire.fi | 1 | 1 | 54 | 23 |
| Larry J | larry@jalcyon.com | 1 | 1 | 5 | 4 |
| Leo Gertsenshteyn | leoger@gmail.com | 1 | 1 | 1 | 1 |
| Leo Jiapei Lin | peipei.520@hotmail.com | 1 | 1 | 1 | 1 |
| Logan Gorence | loganjohngorence@gmail.com | 1 | 1 | 1 | 1 |
| Manuel Prinz | manuel@pinguinkiste.de | 1 | 1 | 4 | 0 |
| Marcin Grzejszczak | marcin@grzejszczak.pl | 1 | 2 | 84 | 6 |
| Marcin Zajaczkowski | szpak@users.sourceforge.net | 1 | 2 | 31 | 4 |
| Marco-Antonio Avallone | marco.avallone@itds.ch | 1 | 3 | 58 | 5 |
| Martin Gansler | martin.gansler@codecentric.de | 1 | 1 | 1 | 1 |
| Martin Nonnenmacher | martin.nonnenmacher@gmail.com | 1 | 1 | 12 | 11 |
| Marty Neal | marty.neal@oracle.com | 1 | 2 | 15 | 2 |
| Mathieu Bruyen | code@mais-h.eu | 1 | 1 | 7 | 1 |
| Matt Whipple | mwhipple@brightcove.com | 1 | 1 | 7 | 1 |
| Matt Whipple | matt@mattwhipple.com | 1 | 1 | 8 | 8 |
| Mene | arndt@menedev.de | 1 | 3 | 161 | 2 |
| Michael Scovetta | michael.scovetta@gmail.com | 1 | 1 | 53 | 53 |
| Michal Mally | michal@mally.pl | 1 | 2 | 11 | 0 |
| Miro Bezjak | bezjak.miro@gmail.com | 1 | 1 | 2 | 2 |
| Natacha Gabbamonte | ngabbamonte@palantir.com | 1 | 1 | 23 | 1 |
| Nathan Mische | nmische@gmail.com | 1 | 2 | 178 | 13 |
| Nes Cohen | nes@muse.dev | 1 | 1 | 1 | 1 |
| Nicolas Guillaumin | nicolas.guillaumin@zetcom.com | 1 | 6 | 96 | 2 |
| Nikolay Chugunov | nikchugunov@github.com | 1 | 3 | 221 | 0 |
| Octavia Togami | otogami@gradle.com | 1 | 2 | 19 | 4 |
| Okko P | xaaria@protonmail.com | 1 | 1 | 15 | 1 |
| Olivier Croquette | ocroquette@free.fr | 1 | 1 | 1 | 1 |
| Paint_Ninja | PaintNinja@users.noreply.github.com | 1 | 2 | 4 | 4 |
| Patrice Clement | monsieurp@gentoo.org | 1 | 1 | 9 | 6 |
| Patrik Torn | patrik.torn@vincit.fi | 1 | 1 | 6 | 1 |
| Paul Bakker | paul.bakker.nl@gmail.com | 1 | 1 | 0 | 1 |
| Paul Merlin | paulmerlin@apache.org | 1 | 1 | 11 | 0 |
| Paul-Julien Vauthier | pj82491@gmail.com | 1 | 4 | 81 | 9 |
| Paulo Poiati | paulogpoiati@gmail.com | 1 | 2 | 47 | 1 |
| Persi | the_hammer1@freenet.de | 1 | 2 | 37 | 37 |
| Peter Swire | swirepe@gmail.com | 1 | 1 | 2 | 1 |
| Pierre Pinon | pierre@pinon1.fr | 1 | 3 | 6 | 6 |
| Radovan Synek | rsynek@redhat.com | 1 | 1 | 1 | 1 |
| Randall S. Becker | rsbecker@nexbridge.com | 1 | 2 | 10 | 2 |
| Rob Upcraft | upcrob@server.fake | 1 | 1 | 1 | 1 |
| Robert Stupp | snazy@snazy.de | 1 | 1 | 1 | 1 |
| Roded Bahat | rodedb@gmail.com | 1 | 2 | 23 | 4 |
| Rohan Ranade | rohan@ranades.net | 1 | 1 | 3 | 3 |
| Roman Shaposhnik | rvs@apache.org | 1 | 1 | 50 | 0 |
| Ryan Tandy | ryan@nardis.ca | 1 | 2 | 76 | 0 |
| Sagar Sane | sagar2217@gmail.com | 1 | 1 | 1 | 1 |
| Sean Flanigan | sflaniga@redhat.com | 1 | 1 | 4 | 1 |
| Sergey Khudyakov | sergeyhudyakov@gmail.com | 1 | 1 | 1 | 1 |
| Shruti Gupta | shrgupt@microsoft.com | 1 | 2 | 16 | 6 |
| Spencer Allain | spencer_allain@yahoo.com | 1 | 2 | 625 | 0 |
| Stefan Armbruster | stefan@armbruster-it.de | 1 | 2 | 47 | 9 |
| Stefan Oehme | st.oehme@gmail.com | 1 | 8 | 39 | 7 |
| Stephen Mallette | spmva@genoprime.com | 1 | 2 | 12 | 1 |
| Suk-Hyun Cho | choey2k5@gmail.com | 1 | 2 | 23 | 1 |
| Szymon Stepniak | szymon.stepniak@gmail.com | 1 | 2 | 64 | 0 |
| T45K | tasktas9@gmail.com | 1 | 1 | 1 | 1 |
| Taher Ghaleb | taher.a.ghaleb@gmail.com | 1 | 4 | 34 | 26 |
| Ten000hours | 502250806@qq.com | 1 | 10 | 113 | 100 |
| Thomas M. DuBuisson | tommd@musedev.io | 1 | 1 | 1 | 0 |
| Tobias Gesellchen | tobias@gesellix.de | 1 | 3 | 71 | 7 |
| Tobias Schulte | tobias.schulte@gliderpilot.de | 1 | 1 | 1 | 1 |
| Urs Keller | urs.keller@lightspeedhq.com | 1 | 2 | 11 | 1 |
| Venkatesh-Prasad Ranganath | rvprasad@ksu.edu | 1 | 2 | 9 | 1 |
| Vihang D | vihang007@gmail.com | 1 | 1 | 1 | 1 |
| Vihang D | vihang.dudhalkar@gmail.com | 1 | 1 | 5 | 3 |
| Wil Selwood | wselwood@ijento.com | 1 | 2 | 12 | 1 |
| Xavier DETANT | xavier.detant@gmail.com | 1 | 1 | 2 | 2 |
| Yannick Welsch | yannick@elastic.co | 1 | 1 | 4 | 2 |
| Yih Tsern | sim_yihtsern@yahoo.com | 1 | 1 | 23 | 0 |
| Youri Ackx | youri@ackx.net | 1 | 1 | 13 | 2 |
| aalku | aalku7@gmail.com | 1 | 1 | 1 | 1 |
| aalmiray | aalmiray@yahoo.com | 1 | 1 | 1 | 1 |
| albert-github | albert.tests@gmail.com | 1 | 1 | 1 | 1 |
| amadarain | t.f.octo@gmail.com | 1 | 1 | 1 | 1 |
| anand raman | araman@gmail.com | 1 | 1 | 2 | 0 |
| anujbhatia | anujbhatia@gmail.com | 1 | 1 | 1 | 1 |
| asa | asa@entimo.de | 1 | 1 | 10 | 0 |
| asutosh936 | asutosh.pandya@hotmail.com | 1 | 1 | 1 | 1 |
| belkaram | ramunas.belkauskas@gmail.com | 1 | 1 | 8 | 0 |
| bpaulin | bpaulin@BOB_PAULIN | 1 | 2 | 10 | 1 |
| caocao485 | cao_cao485@qq.com | 1 | 1 | 1 | 1 |
| caoli5288 | caoli5288@gmail.com | 1 | 1 | 55 | 6 |
| chenyahui | cyhone@qq.com | 1 | 1 | 1 | 1 |
| daniel.sun | daniel.sun@onebank.com.cn | 1 | 1 | 1 | 1 |
| davidmichaelkarr | davidmichaelkarr@gmail.com | 1 | 1 | 5 | 5 |
| emesx | emesx@emesx | 1 | 1 | 1 | 1 |
| fi stach | fistach@gmail.com | 1 | 1 | 1 | 1 |
| fintelia | fintelia@gmail.com | 1 | 1 | 3 | 2 |
| fschn | fschnabel007@gmail.com | 1 | 4 | 2174 | 661 |
| guangwu | guoguangwu@magic-shield.com | 1 | 1 | 1 | 1 |
| jfranco | jorge.franco.leza@gmail.com | 1 | 2 | 11 | 1 |
| kapoormanish | manishkapoor1989@gmail.com | 1 | 1 | 1 | 1 |
| kawatea | yukibbb03@gmail.com | 1 | 2 | 27 | 13 |
| kotomoto | jkotor@gmail.com | 1 | 1 | 1 | 1 |
| liningrui | liningrui@baidu.com | 1 | 1 | 5 | 0 |
| maciekwiso | maciekwiso@o2.pl | 1 | 1 | 1 | 1 |
| manouti | manouti@users.noreply.github.com | 1 | 1 | 10 | 14 |
| noamt | noam@10ne.org | 1 | 3 | 83 | 5 |
| paul-bjorkstrand | paul.bjorkstrand@gmail.com | 1 | 1 | 1 | 1 |
| pavel | pavel@192.168.0.6 | 1 | 1 | 10 | 4 |
| rohit kumar | rohit.kumar@tothenew.com | 1 | 1 | 1 | 1 |
| sszuev | sss.zuev@gmail.com | 1 | 3 | 28 | 1 |
| tison | wander4096@gmail.com | 1 | 1 | 24 | 23 |
| tmoore | tmoore@spatial.ca | 1 | 1 | 48 | 0 |
| wangjianan | wangjianan@huawei.com | 1 | 1 | 1 | 1 |
| zhangt2333 | zhangt2333@gmail.com | 1 | 12 | 13 | 13 |
| zhao fan | 359130530@qq.com | 1 | 1 | 1 | 1 |
+---------------------------------+---------------------------------------+------------+-----------------+---------------+--------------+

+---------------------------------+---------------------------------------+------------+-----------------+---------------+--------------+
| author | email | sumCommits | sumFilesChanged | sumInsertions | sumDeletions |
+---------------------------------+---------------------------------------+------------+-----------------+---------------+--------------+
| | | 19744 | 78146 | 2014767 | 1296490 |
+---------------------------------+---------------------------------------+------------+-----------------+---------------+--------------+

附录

以下是完整的脚本内容,最新版本可访问GitHub获取(git-statistics

@Grab(group='com.belerweb', module='pinyin4j', version='2.5.1')
import net.sourceforge.pinyin4j.PinyinHelper
import java.text.SimpleDateFormat

def sdf = new SimpleDateFormat('yyyyMMdd')
def sinceDate
def untilDate

try {
sinceDate = sdf.parse(args[0])
untilDate = sdf.parse(args[1])
} catch (e) {
println "Usage: groovy GitStats.groovy <begin(yyyyMMdd)> <end(yyyyMMdd)>"
return
}

def generateGitLog(Date since, Date until) {
def sdf = new SimpleDateFormat('yyyy-MM-dd')
def gitLogFile = File.createTempFile("gitstats_${System.nanoTime()}", ".log")
def cmdLine = """cmd /c "git fetch && git log --shortstat --date-order --pretty=format:%s###%aN###%ae###%ai --since=${sdf.format(since)} --until=${sdf.format(until)} > ${gitLogFile.absolutePath}" """
cmdLine.execute().waitFor()
return gitLogFile
}

def toPinyin = { String str ->
StringBuilder sb = new StringBuilder()
for (char c : str) {
String[] py = PinyinHelper.toHanyuPinyinStringArray(c)
sb << (py ? py[0] : c)
}
return sb.toString()
}

def gitLogFile = generateGitLog(sinceDate, untilDate)
def content = gitLogFile.getText('UTF-8')
def commitInfoList = content.findAll(/(?s)([^\r\n]+?)###([a-zA-Z_.\d\u4e00-\u9fa5- ]+)###([a-zA-Z_.\d-]+@[a-zA-Z_.\d-]+)###(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [+-]\d{4})\r?\n\s+(\d+)\s+file(?:s)? changed(?:,\s+(\d+)\s+insertion(?:s)?\([+]\))?(?:,\s+(\d+)\s+deletion(?:s)?\(-\))?\r?\n/) { _0, _1, _2, _3, _4, _5, _6, _7 ->
def commitInfo = new CommitInfo(
subject: _1,
author: toPinyin(_2),
email: _3,
date: new SimpleDateFormat('yyyy-MM-dd HH:mm:ss Z').parse(_4),
fileChanged: (_5?:'0') as int,
insertions: (_6?:'0') as int,
deletions: (_7?:'0') as int
)

return commitInfo
}

def result = GQ {
from c in commitInfoList
groupby c.email
orderby count() in desc, max(c.author)
select max(c.author) as author, c.email, count() as sumCommits, sum(c.fileChanged) as sumFilesChanged, sum(c.insertions) as sumInsertions, sum(c.deletions) as sumDeletions
}

print result

def mal = GQ {
from r in result
select max(r.author.length()) as malOfAuthor, max(r.email.length()) as malOfEmail
}.stream().findFirst().get()

def sumResult = GQ {
from r in result
select ' ' * mal.malOfAuthor as author, ' ' * mal.malOfEmail as email, sum(r.sumCommits) as sumCommits, sum(r.sumFilesChanged) as sumFilesChanged, sum(r.sumInsertions) as sumInsertions, sum(r.sumDeletions) as sumDeletions
}
print sumResult

@groovy.transform.ToString
class CommitInfo {
String subject
String author
String email
Date date
int fileChanged
int insertions
int deletions
}