@@ -90,10 +90,24 @@ string gitHEAD()
90
90
return m[1 ];
91
91
}
92
92
93
+ string gitRemotePath ()
94
+ {
95
+ auto ret = execute([" git" , " remote" , " -v" ]);
96
+ enforce(ret.status == 0 );
97
+ auto m = ret.output.matchFirst(` origin\s*(.+) \(fetch\)` );
98
+ enforce(m, " broken git log" );
99
+ // NOTE: matching others remotes can be hacked here
100
+ m = m[1 ].matchFirst(` github.com[:/](.*)/(\S+)\.git` );
101
+ enforce(m, " failed to find origin remote" );
102
+ return m[1 ]~ " /" ~ m[2 ];
103
+ }
104
+
93
105
94
106
void main (){
95
- string gitHash = gitHEAD;
96
- string gitRepo = ` https://github.com/D-Programming-Language/` ;
107
+ string fmt = " mediawiki" ;
108
+ string gitHost = ` https://github.com` ;
109
+ string gitHash = gitHEAD();
110
+ string gitRepo = gitRemotePath();
97
111
auto re = regex(` (.*[\\/]\w+)\.d\((\d+)\):\s*vgc:\s*(.*)` );
98
112
// writeln(`std\variant.d(236): vgc: 'new' causes GC allocation`.match(re));
99
113
Result[] results;
@@ -108,7 +122,7 @@ void main(){
108
122
results = uniq(results).array;
109
123
110
124
string linkTemplate =
111
- ` [%s/phobos /blob/%s/%s.d#L%s %s]` ;
125
+ ` [%s/%s /blob/%s/%s.d#L%s %s]` ;
112
126
writeln(`
113
127
{| class="wikitable"
114
128
! Module
@@ -121,7 +135,7 @@ void main(){
121
135
auto mod = r.file.replace(" /" , " ." );
122
136
auto artifact = findAtrifact(r);
123
137
if (! artifact.endsWith(" unittest" )){
124
- auto link = format(linkTemplate, gitRepo, gitHash, r.file, r.line, mod);
138
+ auto link = format(linkTemplate, gitHost, gitRepo, gitHash, r.file, r.line, mod);
125
139
writef(" |%s\n |%s\n |%s\n | ???\n |-\n " , link, artifact, r.reason);
126
140
}
127
141
}
0 commit comments