@@ -20,6 +20,7 @@ use lib ‘.’;
20
20
use Whateverable;
21
21
22
22
use File::Temp;
23
+ use File::Directory::Tree;
23
24
use IRC::Client;
24
25
25
26
unit class Bisectable is Whateverable;
@@ -76,7 +77,7 @@ method test-commit($code-file, $compare-to?) {
76
77
my ($ output , $ exit-code ) = self . get-output($ perl6 , ' --setting=RESTRICTED' , ' --' , $ code-file );
77
78
$ log ~ = " »»»»» Script output:\n " ;
78
79
$ log ~ = $ output ;
79
- $ log ~ = " »»»»» Script exit code: $ exit-code\n " ;
80
+ $ log ~ = " \n »»»»» Script exit code: $ exit-code\n " ;
80
81
81
82
# plain bisect
82
83
unless $ compare-to {
@@ -104,11 +105,11 @@ method test-commit($code-file, $compare-to?) {
104
105
$ log ~ = " »»»»» Comparing the output to:\n " ;
105
106
$ log ~ = $ output-good ;
106
107
if $ output eq $ output-good {
107
- $ log ~ = " »»»»» The output is identical\n " ;
108
+ $ log ~ = " \n »»»»» The output is identical\n " ;
108
109
$ log ~ = " »»»»» Final exit code: 0\n " ;
109
110
return ($ log , 0 );
110
111
} else {
111
- $ log ~ = " »»»»» The output is different\n " ;
112
+ $ log ~ = " \n »»»»» The output is different\n " ;
112
113
$ log ~ = " »»»»» Final exit code: 1\n " ;
113
114
return ($ log , 1 );
114
115
}
@@ -187,49 +188,53 @@ method process($message, $code is copy, $good, $bad) {
187
188
my $ output-file = ‘ ’ ;
188
189
if $ exit-good == $ exit-bad {
189
190
$ message . reply: “ Exit code is $ exit-bad on both starting points (good=$ short-good bad=$ short-bad ), bisecting by using the output” ;
190
- ($ output-file , my $ fh ) = tempfile : unlink;
191
+ ($ output-file , my $ fh ) = tempfile :! unlink ;
191
192
$ fh . print : $ out-good ;
192
193
$ fh . close ;
193
194
}
194
195
if $ exit-good != $ exit-bad and $ exit-good != 0 {
195
196
$ message . reply: “ For the given starting points (good=$ short-good bad=$ short-bad ), exit code on a ‘good’ revision is $ exit-good (which is bad), bisecting with inverted logic” ;
196
197
}
197
198
198
- my $ result ; # RT 128872
199
- {
200
- my $ dir = tempdir : unlink;
201
- run (‘ git’ , ‘ clone’ , RAKUDO, $ dir );
202
- chdir $ dir ;
203
- LEAVE chdir $ old-dir ;
204
-
205
- self . get-output(‘ git’ , ‘ bisect’ , ‘ start’ );
206
- self . get-output(‘ git’ , ‘ bisect’ , ‘ good’ , $ full-good );
207
- my ($ init-output , $ init-status ) = self . get-output(‘ git’ , ‘ bisect’ , ‘ bad’ , $ full-bad );
208
- if $ init-status != 0 {
209
- $ message . reply: ‘ bisect log: ’ ~ self . upload({ ‘ query’ => $ message . text,
210
- ‘ description’ => $ message . server. current-nick,
211
- ‘ result’ => $ init-output });
212
- return ‘ bisect init failure’ ;
213
- }
214
- my ($ bisect-output , $ bisect-status );
215
- if $ output-file {
216
- ($ bisect-output , $ bisect-status ) = self . run-bisect($ filename , $ output-file );
217
- } else {
218
- if $ exit-good == 0 {
219
- ($ bisect-output , $ bisect-status ) = self . run-bisect($ filename );
220
- } else {
221
- ($ bisect-output , $ bisect-status ) = self . run-bisect($ filename , $ exit-good );
222
- }
223
- }
199
+ my $ dir = tempdir :! unlink ;
200
+ run (‘ git’ , ‘ clone’ , RAKUDO, $ dir );
201
+ chdir $ dir ;
202
+
203
+ self . get-output(‘ git’ , ‘ bisect’ , ‘ start’ );
204
+ self . get-output(‘ git’ , ‘ bisect’ , ‘ good’ , $ full-good );
205
+ my ($ init-output , $ init-status ) = self . get-output(‘ git’ , ‘ bisect’ , ‘ bad’ , $ full-bad );
206
+ if $ init-status != 0 {
224
207
$ message . reply: ‘ bisect log: ’ ~ self . upload({ ‘ query’ => $ message . text,
225
208
‘ description’ => $ message . server. current-nick,
226
- ‘ result’ => “ $ init-output\n $ bisect-output” });
209
+ ‘ result’ => $ init-output });
210
+ return ‘ bisect init failure’ ;
211
+ }
212
+ my ($ bisect-output , $ bisect-status );
213
+ if $ output-file {
214
+ ($ bisect-output , $ bisect-status ) = self . run-bisect($ filename , $ output-file );
215
+ } else {
216
+ if $ exit-good == 0 {
217
+ ($ bisect-output , $ bisect-status ) = self . run-bisect($ filename );
218
+ } else {
219
+ ($ bisect-output , $ bisect-status ) = self . run-bisect($ filename , $ exit-good );
220
+ }
221
+ }
222
+ $ message . reply: ‘ bisect log: ’ ~ self . upload({ ‘ query’ => $ message . text,
223
+ ‘ description’ => $ message . server. current-nick,
224
+ ‘ result’ => “ $ init-output\n $ bisect-output” });
227
225
228
- return “ ‘bisect run’ failure” if $ bisect-status != 0 ;
226
+ if $ bisect-status != 0 {
227
+ return “ ‘bisect run’ failure” ;
228
+ } else {
229
+ return self . get-output(‘ git’ , ‘ show’ , ‘ --quiet’ , ‘ --date=short’ , “ --pretty=(% cd ) { LINK} /% h” , ‘ bisect/bad’ ). first ;
230
+ }
229
231
230
- ($ result ,) = self . get-output(‘ git’ , ‘ show’ , ‘ --quiet’ , ‘ --date=short’ , “ --pretty=(% cd ) { LINK} /% h” , ‘ bisect/bad’ );
232
+ LEAVE {
233
+ chdir $ old-dir ;
234
+ unlink $ output-file ;
235
+ unlink $ filename ;
236
+ rmtree $ dir ;
231
237
}
232
- return $ result ;
233
238
}
234
239
235
240
Bisectable. new . selfrun(‘ bisectable6’ , [‘ bisect’ ]);
0 commit comments