Skip to content

Commit fa817c3

Browse files
committed
Add list-checkouts command to bench
1 parent 21bd960 commit fa817c3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

bench

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,35 @@ multi MAIN ('extract', *@components) {
172172
}
173173
}
174174

175+
#= List checked out component trees with matching git revision
176+
multi MAIN ('list-checkouts', *@components) {
177+
needs-setup('list');
178+
179+
my $max-length = max(for-checkouts @components, -> $, $name, $checkout { "$name/$checkout".chars }, :quiet);
180+
my $format = "%-{$max-length}s %s\n";
181+
printf $format, < CHECKOUT REVISION >;
182+
printf $format, < -------- -------- >;
183+
184+
for-checkouts @components, -> $comp, $name, $checkout {
185+
my $subdir = "$name/$checkout";
186+
my $comp-dir = "$COMPONENTS_DIR/$subdir";
187+
if $comp-dir.IO.d {
188+
my $git-dir = "$comp-dir/.git";
189+
if $git-dir.IO.d {
190+
%*ENV<GIT_DIR> = $git-dir;
191+
my $desc = qx/git describe --always/.chomp;
192+
printf $format, $subdir, $desc;
193+
}
194+
else {
195+
printf $format, $subdir, '[NOT A GIT CHECKOUT]';
196+
}
197+
}
198+
else {
199+
printf $format, $subdir, '[NOT FOUND]';
200+
}
201+
}, :quiet;
202+
}
203+
175204
#= Build checked out component trees
176205
multi MAIN ('build', *@components) {
177206
needs-setup('build components');

0 commit comments

Comments
 (0)