@@ -175,7 +175,7 @@ Nullable!DateTime getFirstDateTime(string revRange)
175175struct GitIssues
176176{
177177 int [] bugzillaIssueIds;
178- int [] githubIssueIds;
178+ int [][ string ] githubIssueIds;
179179}
180180
181181/* * Get a list of all bugzilla issues mentioned in revRange */
@@ -194,7 +194,7 @@ GitIssues getIssues(string revRange)
194194 enum closedREGH = ctRegex! (` (?:^fix(?:es)?(?:\s+github)?(?:\s+(?:issues?|bugs?))?\s+(#?\d+(?:[\s,\+&and]+#?\d+)*))` , " i" );
195195
196196 auto issuesBZ = appender! (int []);
197- auto issuesGH = appender ! ( int []) ;
197+ int [][ string ] issuesGH ;
198198 foreach (repo; [" dmd" , " phobos" , " dlang.org" , " tools" , " installer" ]
199199 .map! (r => buildPath(" .." , r)))
200200 {
@@ -207,6 +207,7 @@ GitIssues getIssues(string revRange)
207207 p = pipeProcess(cmd, Redirect.stdout);
208208 scope (exit) enforce (wait(p.pid) == 0 , " Failed to execute '%(%s %)'." .format(cmd));
209209
210+ auto matchesGH = appender! (int []);
210211 foreach (line; p.stdout.byLine())
211212 {
212213 if (auto m = match(line.stripLeft, closedREBZ))
@@ -223,12 +224,12 @@ GitIssues getIssues(string revRange)
223224 .splitter(ctRegex! ` [^\d]+` )
224225 .filter! (b => b.length)
225226 .map! (to! int )
226- .copy(issuesGH );
227+ .copy(matchesGH );
227228 }
228229 }
230+ issuesGH[repo[3 .. $]] = matchesGH.data.sort().release.uniq.array;
229231 }
230- return GitIssues (issuesBZ.data.sort().release.uniq.array
231- ,issuesGH.data.sort().release.uniq.array);
232+ return GitIssues (issuesBZ.data.sort().release.uniq.array, issuesGH);
232233}
233234
234235/* * Generate and return the change log as a string. */
@@ -305,26 +306,39 @@ Nullable!int getBugzillaId(string body_)
305306 return ret;
306307}
307308
308- GithubIssue[][string /* type*/ ][string /* comp*/ ] getGithubIssuesRest(const DateTime startDate ,
309- const DateTime endDate, const string bearer)
309+ GithubIssue[][string /* type*/ ][string /* comp*/ ] getGithubIssuesRest(string revRange ,
310+ const DateTime startDate, const DateTime endDate, const string bearer)
310311{
312+ import std.algorithm.searching : canFind;
313+
311314 GithubIssue[][string ][string ] ret;
312315 string [2 ][] comps =
313316 [ [ " dlang.org" , " dlang.org" ]
314317 , [ " dmd" , " DMD Compiler" ]
315- , [ " druntime" , " Druntime" ]
318+ // , [ "druntime", "Druntime"] // Archived
316319 , [ " phobos" , " Phobos" ]
317320 , [ " tools" , " Tools" ]
318- , [ " dub" , " Dub" ]
319- , [ " visuald" , " VisualD" ]
321+ // , [ "dub", "Dub"] // ???: Not searched in getIssues
322+ // , [ "visuald", "VisualD"] // ???:
323+ , [ " installer" , " Installer" ]
320324 ];
325+ GitIssues issues = getIssues(revRange);
321326 foreach (it; comps)
322327 {
328+ // abort prematurely if no issues are found in all git logs
329+ string project = it[0 ];
330+ if (project ! in issues.githubIssueIds || issues.githubIssueIds[project].empty)
331+ continue ;
332+
323333 GithubIssue[][string /* type */ ] tmp;
324- GithubIssue[] ghi = getGithubIssuesRest(" dlang" , it[ 0 ] , startDate,
334+ GithubIssue[] ghi = getGithubIssuesRest(" dlang" , project , startDate,
325335 endDate, bearer);
326336 foreach (jt; ghi)
327337 {
338+ // ignore if closed issue does not have a git log reference
339+ if (! issues.githubIssueIds[project].canFind(jt.id))
340+ continue ;
341+
328342 GithubIssue[]* p = jt.type in tmp;
329343 if (p ! is null )
330344 {
@@ -805,7 +819,7 @@ Please supply a bugzilla version
805819
806820 Nullable! (DateTime ) firstDate = getFirstDateTime(revRange);
807821 enforce(! firstDate.isNull(), " Couldn't find a date from the revRange" );
808- githubChanges = getGithubIssuesRest(firstDate.get (), cast (DateTime )currDate
822+ githubChanges = getGithubIssuesRest(revRange, firstDate.get (), cast (DateTime )currDate
809823 , githubToken);
810824 }
811825
0 commit comments