@@ -631,18 +631,35 @@ bool less(T)(ref T a, ref T b)
631
631
return lessImpl (a, b);
632
632
}
633
633
634
+ enum BugzillaOrGithub {
635
+ bugzilla,
636
+ github
637
+ }
638
+
634
639
/**
635
640
Writes the fixed issued from Bugzilla in the ddoc format as a single list.
636
641
637
642
Params:
638
643
changes = parsed InputRange of changelog information
639
644
w = Output range to use
640
645
*/
641
- void writeBugzillaChanges (Entries, Writer )(Entries entries, Writer w)
646
+ void writeBugzillaChanges (Entries, Writer )(BugzillaOrGithub bog, Entries entries, Writer w)
642
647
if (isOutputRange! (Writer , string ))
643
648
{
644
649
immutable components = [" DMD Compiler" , " Phobos" , " Druntime" , " dlang.org" , " Optlink" , " Tools" , " Installer" ];
645
650
immutable bugtypes = [" regression fixes" , " bug fixes" , " enhancements" ];
651
+ const string macroTitle = () {
652
+ final switch (bog) {
653
+ case BugzillaOrGithub.bugzilla: return " BUGSTITLE_BUGZILLA" ;
654
+ case BugzillaOrGithub.github: return " BUGSTITLE_GITHUB" ;
655
+ }
656
+ }();
657
+ const string macroLi = () {
658
+ final switch (bog) {
659
+ case BugzillaOrGithub.bugzilla: return " BUGZILLA" ;
660
+ case BugzillaOrGithub.github: return " GITHUB" ;
661
+ }
662
+ }();
646
663
647
664
foreach (component; components)
648
665
{
@@ -652,11 +669,11 @@ void writeBugzillaChanges(Entries, Writer)(Entries entries, Writer w)
652
669
{
653
670
if (auto bugs = bugtype in * comp)
654
671
{
655
- w.formattedWrite(" $(BUGSTITLE_BUGZILLA %s %s,\n\n " , component, bugtype);
672
+ w.formattedWrite(" $(%s %s %s,\n\n " , macroTitle , component, bugtype);
656
673
alias lessFunc = less! (ElementEncodingType! (typeof (* bugs)));
657
674
foreach (bug; sort! lessFunc(* bugs))
658
675
{
659
- w.formattedWrite(" $(LI $(BUGZILLA %s): %s)\n " ,
676
+ w.formattedWrite(" $(LI $(%s %s): %s)\n " , macroLi ,
660
677
bug.id, bug.summary.escapeParens());
661
678
}
662
679
w.put(" )\n " );
@@ -842,11 +859,11 @@ Please supply a bugzilla version
842
859
// print the entire changelog history
843
860
if (revRange.length)
844
861
{
845
- bugzillaChanges. writeBugzillaChanges(w);
862
+ writeBugzillaChanges(BugzillaOrGithub.bugzilla, bugzillaChanges, w);
846
863
}
847
864
if (revRange.length)
848
865
{
849
- githubChanges. writeBugzillaChanges(w);
866
+ writeBugzillaChanges(BugzillaOrGithub.github, githubChanges, w);
850
867
}
851
868
}
852
869
0 commit comments