summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/list_merged_branches.pl
blob: acc5441c4c989eb06349f1e96f51bd3713326e13 (plain) (blame)
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
#!/usr/bin/env perl

%remote_branches;
%merged_branches;

open (REMOTE, "git branch -a|");
while (<REMOTE>)
{
    my ($branch) = /remotes\/origin\/(.*)$/;
    $remote_branches{$branch} = 1;
}
close REMOTE;

open(LOG, "git log master|");
while (<LOG>)
{
    my $branch;
    next unless (($branch) = /Merge branch '(.*)'/);
    next if ($branch eq "master");
    next unless ($remote_branches{$branch});
    next if ($merged_branches{$branch});
    $merged_branches{$branch} = 1;
    print "$branch\n";
}
close LOG;