-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtickets.pl
118 lines (112 loc) · 3.36 KB
/
tickets.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/perl
use strict;
use warnings;
#
# (1) quit unless we have the correct number of command-line args
my $num_args = $#ARGV + 1;
my $base;
my $stable;
my $devel;
if ($num_args == 2) {
$base = $ARGV[0];
$stable = $ARGV[1];
} elsif ($num_args == 3) {
$base = $ARGV[0];
$stable = $ARGV[1];
$devel = $ARGV[2];
} else {
print "\nUsage: tickets.pl base stable [devel]\n";
exit;
}
my $commit;
my $commits;
my $ticket;
my $git_log_command = "git log --no-decorate --name-only";
my %base_commits;
my %base_tickets;
my $base_commit;
my %stable_tickets;
my %devel_tickets;
print "Reading commits from base $base...\n";
$commits = 0;
open(my $BASE, "-|", "$git_log_command $base");
while(<$BASE>) {
if (/^commit ([[:xdigit:]]+)/) {
$commit = $1;
$base_commits{$commit}++;
}
for my $ticket (/HTCONDOR-(\d+)/gi) { # Jira numbers
$base_tickets{$ticket}++;
$commits++;
# if ($ticket == 1377) {print "base: $_ \n";}
}
}
close($BASE);
print "Processed $commits commits with ticket numbers\n\n";
print "Reading commits from stable $stable...\n";
$commits = 0;
open(my $STABLE, "-|", "$git_log_command $stable");
while(<$STABLE>) {
if (/^commit ([[:xdigit:]]+)/) {
$commit = $1;
$base_commit = $base_commits{$commit};
}
for my $ticket (/HTCONDOR-(\d+)/gi) { # Jira numbers
if (!$base_commit) {
$stable_tickets{$ticket}++;
$commits++;
# if ($ticket == 1377) {print "stable $_ \n";}
}
}
}
close($STABLE);
print "Processed $commits commits with ticket numbers\n\n";
if (!$devel) {
print "Ticket summary:\n";
for my $ticket (sort {$a<=>$b} keys(%stable_tickets)) {
my $commits = $stable_tickets{$ticket};
if ($base_tickets{$ticket}) {
print "Old Ticket #$ticket with $commits commits";
} else {
print "New Ticket #$ticket with $commits commits";
}
print " https://opensciencegrid.atlassian.net/browse/HTCONDOR-$ticket\n";
}
} else {
print "Reading commits from devel $devel...\n";
$commits = 0;
open(my $DEVEL, "-|", "$git_log_command $devel");
while(<$DEVEL>) {
if (/^commit ([[:xdigit:]]+)/) {
$commit = $1;
$base_commit = $base_commits{$commit};
}
for my $ticket (/HTCONDOR-(\d+)/gi) { # Jira numbers
if (!($base_commit)) {
$devel_tickets{$ticket}++;
$commits++;
# if ($ticket == 1377) {print "devel $_ \n";}
}
}
}
close($DEVEL);
print "Processed $commits commits with ticket numbers\n\n";
print "Ticket summary:\n";
for my $ticket (sort {$a<=>$b} keys(%devel_tickets)) {
my $commits = $devel_tickets{$ticket};
if ($base_tickets{$ticket}) {
if ($stable_tickets{$ticket}) {
print "Old Stable Ticket #$ticket with $commits commits";
} else {
print "Old Devel Ticket #$ticket with $commits commits";
}
} else {
if ($stable_tickets{$ticket}) {
print "New Stable Ticket #$ticket with $commits commits";
} else {
print "New Devel Ticket #$ticket with $commits commits";
}
}
print " https://opensciencegrid.atlassian.net/browse/HTCONDOR-$ticket\n";
}
}