85 lines
1.7 KiB
Bash
Executable File
85 lines
1.7 KiB
Bash
Executable File
#!/bin/dash
|
|
|
|
MASTER=master
|
|
|
|
for range in $(
|
|
{
|
|
git for-each-ref --format='%(refname)' refs/heads/maint-\* |
|
|
perl -e '
|
|
sub compare_dotted_version {
|
|
my (@ours) = split(/\./, $_[0]);
|
|
my (@theirs) = split(/\./, $_[1]);
|
|
my ($i, $diff);
|
|
|
|
for ($i = 0; $i < @ours && $i < @theirs; $i++) {
|
|
$diff = $ours[$i] - $theirs[$i];
|
|
return $diff if ($diff);
|
|
}
|
|
return 1 if ($i < @ours);
|
|
return -1 if ($i < @theirs);
|
|
return 0;
|
|
}
|
|
my @maint = ();
|
|
while (<STDIN>) {
|
|
next unless s|^refs/heads/||;
|
|
chomp;
|
|
my ($v) = ($_ =~ /^maint-(.*)$/);
|
|
push @maint, [$v, $_];
|
|
}
|
|
for (map { $_->[1] }
|
|
sort { compare_dotted_version($a->[0], $b->[0]) }
|
|
@maint) {
|
|
print "$_\n";
|
|
}
|
|
' &&
|
|
cat <<-EOF
|
|
maint
|
|
$MASTER
|
|
next
|
|
EOF
|
|
} |
|
|
{
|
|
prev_branch=
|
|
while read branch
|
|
do
|
|
if test -n "$prev_branch"
|
|
then
|
|
echo "$branch..$prev_branch"
|
|
fi
|
|
prev_branch=$branch
|
|
done
|
|
}
|
|
) seen..jch
|
|
do
|
|
lg=$(git log --oneline "$range")
|
|
if test -n "$lg"
|
|
then
|
|
echo "*** $range ***"
|
|
echo "$lg"
|
|
fi
|
|
done
|
|
|
|
if ! next_equiv=$(git rev-parse --verify 'jch^{/^### match next}' 2>/dev/null) ||
|
|
! git diff --stat --exit-code next $next_equiv
|
|
then
|
|
next_tree=$(git rev-parse next^{tree}) &&
|
|
next_equiv=$(git rev-list --first-parent $MASTER^..seen |
|
|
xargs -n1 sh -c '
|
|
echo $(git rev-parse $1^{tree}) $1
|
|
' - | sed -n -e "s/^$next_tree //p"
|
|
)
|
|
fi
|
|
|
|
if test -n "$next_equiv"
|
|
then
|
|
jch=$(git rev-list --first-parent $MASTER..jch | wc -l) &&
|
|
seen=$(git rev-list --first-parent $MASTER..seen | wc -l) &&
|
|
next=$(git rev-list --first-parent $MASTER..$next_equiv | wc -l) &&
|
|
if test $jch -le $next
|
|
then
|
|
echo "$MASTER..$jch..jch..$next..next..$seen..seen"
|
|
else
|
|
echo "$MASTER..$next..next..$jch..jch..$seen..seen"
|
|
fi
|
|
fi
|