7 my ($branches, $fname) = @_;
9 # requires perl 5.8. Avoids shell issues if we ever get a changes
10 # file named by the parents of Little Johnny Tables.
11 open F
, "-|", "git", "log", "--pretty=format:%H", $branches, "--", $fname
14 return scalar @changes
17 my $look_for_type = "merged";
22 findMergedChanges.pl [--merged/--unmerged/--weird/--list] [--branch=<branchname] changes/*
24 A change is "merged" if it has ever been merged to release-0.2.4 and it has had
25 no subsequent changes in master.
27 A change is "unmerged" if it has never been merged to release-0.2.4 and it
28 has had changes in master.
30 A change is "weird" if it has been merged to release-0.2.4 and it *has* had
31 subsequent changes in master.
33 Suggested application:
34 findMergedChanges.pl --merged changes/* | xargs -n 1 git rm
39 my $target_branch = "origin/release-0.2.4";
41 while (@ARGV and $ARGV[0] =~ /^--/) {
42 my $flag = shift @ARGV;
43 if ($flag =~ /^--(weird|merged|unmerged|list)/) {
45 } elsif ($flag =~ /^--branch=(\S+)/) {
48 die "Unrecognized flag $flag";
52 for my $changefile (@ARGV) {
53 my $n_merged = nChanges
($target_branch, $changefile);
54 my $n_postmerged = nChanges
("${target_branch}..origin/master", $changefile);
57 if ($n_merged != 0 and $n_postmerged == 0) {
59 } elsif ($n_merged == 0 and $n_postmerged != 0) {
65 if ($type eq $look_for_type) {
66 print "$changefile\n";
67 } elsif ($look_for_type eq 'list') {
68 printf "% 8s: %s\n", $type, $changefile;