Add script to query for contributors between two releases#253
Add script to query for contributors between two releases#253wilzbach merged 3 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
contributors.d
Outdated
|
|
||
| File(gitComitMappingFile) | ||
| .byLineCopy | ||
| // ignore empty lines and comments, but allow `#ponce` |
There was a problem hiding this comment.
Yeah there's a line in the .commitmap that starts like this, but thinking about it it makes more sense to use an extra whitespace for it.
That sounds like something that ought to be done via the GitHub API (or just taken out of the git history). |
|
What is this .commitmap file BTW? Some existing convention? Couldn't find anything about it. |
Yeah I will use mailmap on the next iteration. |
|
lgtm |
|
I've already started a mailmap for dmd, https://github.com/dlang/dmd/blob/59e801d060ee13705cbf3bf73e1b4bc8a12aa60d/.mailmap. |
MartinNowak
left a comment
There was a problem hiding this comment.
Might just be me, but this looks as if it could be done in about 10-20 lines of bash.
contributors.d
Outdated
| line.skipOver(Author); | ||
| return line.readUser; | ||
| }) | ||
| .filter!(a => a.name != "The Dlang Bot") |
There was a problem hiding this comment.
Maybe you'd rather want to filter out merges, --no-merges.
There was a problem hiding this comment.
There's already a flag to change to this behavior. However, I wasn't sure whether we really want to exclude merges by default.
d863be3 to
c301e82
Compare
Probably, but then (1) you always run into some special behavior of bash or things that are tricky and (2) (and this is the main reason) doing it in D allows us more flexibility as I am still not sure where we will use/display this information
Done. This should be good as an initial script. The |
c301e82 to
e3dbef2
Compare
|
Ping @CyberShadow @andralex @ZombineDev - can we move forward with this? |
contributors.d
Outdated
| return line.readUser; | ||
| }) | ||
| .filter!(a => a.name != "The Dlang Bot") | ||
| .each!(author => authors ~= author); |
There was a problem hiding this comment.
Nit, unnecessary each. Instead you can do authors ~= p.stdout.....filter!(...);
CyberShadow
left a comment
There was a problem hiding this comment.
Looks good, seems to work as intended.
contributors.d
Outdated
| import std.uni : sicmp; | ||
| return authors | ||
| .sort!((a, b) => sicmp(a.name, b.name) < 0) | ||
| .release |
There was a problem hiding this comment.
.release seems unnecessary here
contributors.d
Outdated
| auto p = pipeProcess(cmd, Redirect.stdout); | ||
| scope(exit) enforce(wait(p.pid) == 0, "Failed to execute '%(%s %)'.".format(cmd)); | ||
|
|
||
| static immutable Author = "Author: "; |
There was a problem hiding this comment.
Instead of parsing the default git log output, you can just ask it to print the data in the format you want. You probably want --pretty=format:%aN.
contributors.d
Outdated
| email: ps.dropOne.front.filter!(a => a != '"').until('>').to!string | ||
| }; | ||
| return author; | ||
| } |
There was a problem hiding this comment.
This function is unnecessary if you use git log's format option.
Well initially I did the mapping myself, before I figured that it's probably a lot better to use
OTOH I don't really care that much about it. What do you think? |
|
Sorry, I think there's a misunderstanding. I meant, you're expending a non-trivial amount of code/logic for parsing the default git log output format. Whereas, we could use the |
|
Somehow my message got lost due to the great WiFi on German trains....
"+3 −16" - can't argue much about this! -> Will merge this now & look into integrating it with dlang.org |
| Walter Waldron <WalterWaldron@users.noreply.github.com> | ||
| Yazan Dabain <yazan.dabain@arabiaweather.com> <yazan.dabain@gmail.com> | ||
| Михаил Страшун <public@dicebot.lv> <m.strashun@gmail.com> | ||
| Yao Gómez <yao.gomez@gmail.com> <yaoltzin@gmail.com> |
There was a problem hiding this comment.
Should we remove the dlang repo specific mailmaps then?
| enforce(wait(p.pid) == 0, "Failed to execute '%(%s %)'.".format(cmd)); | ||
| } | ||
|
|
||
| auto cmd = ["git", "-c", "mailmap.file=%s".format(config.mailmapFile), "-C", repo, "log", "--use-mailmap", "--pretty=format:%aN|%aE"]; |
There was a problem hiding this comment.
git -C only works with newer versions of git
There was a problem hiding this comment.
git 1.8.3 is an ancient dinosaur (more than four years old) 😉
There was a problem hiding this comment.
std.process functions allow you to specify a working directory anyway.
I don't know yet how we are going to integrate this on dlang.org, but this script should be more than flexible enough to accompany many possible scenarios.
Ideas: