perf/aggregate: add --reponame option
This makes it easier to use the aggregate script on the command line when one wants to get the "environment" fields set in the codespeed output. Previously setting GIT_REPO_NAME was needed for this purpose. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Feb 1, 2018 at 11:14 UTC
fb2c362eb5dd998b74a30fe55df3f44a26ea6fd6
1 file changed
+13
-2
t/perf/aggregate.perl
+13
-2
@@ -37,7 +37,7 @@ sub format_times {
37
}
38
39
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
40
- $codespeed, $subsection);
40
+ $codespeed, $subsection, $reponame);
41
while (scalar @ARGV) {
42
my $arg = $ARGV[0];
43
my $dir;
@@ -55,6 +55,15 @@ while (scalar @ARGV) {
55
}
56
next;
57
}
58
+ if ($arg eq "--reponame") {
59
+ shift @ARGV;
60
+ $reponame = $ARGV[0];
61
+ shift @ARGV;
62
+ if (! $reponame) {
63
+ die "empty reponame";
64
+ }
65
+ next;
66
+ }
67
last if -f $arg or $arg eq "--";
68
if (! -d $arg) {
69
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
@@ -210,7 +219,9 @@ sub print_codespeed_results {
219
}
220
221
my $environment;
213
- if (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
222
+ if ($reponame) {
223
+ $environment = $reponame;
224
+ } elsif (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
225
$environment = $ENV{GIT_PERF_REPO_NAME};
226
} elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne "") {
227
$environment = $ENV{GIT_TEST_INSTALLED};