mirror of
https://github.com/git/git.git
synced 2026-03-04 22:47:35 +01:00
Meta: remove obviously stale, unused, and useless bits
This commit is contained in:
31
SR
31
SR
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
short=
|
||||
case "$1" in --short|-s) short=t; shift ;; esac
|
||||
|
||||
parse_version='
|
||||
s/^\(v[.0-9]*\)\(-\([1-9][0-9]*\)-g\([0-9a-f][0-9a-f]*\)\)*$/v=\1 n=\3 r=\4/
|
||||
'
|
||||
|
||||
git for-each-ref --format='%(refname)' refs/heads/maint\* |
|
||||
sed -e 's|^refs/heads/||' -e '/^maint[^-]/d' |
|
||||
while read track
|
||||
do
|
||||
case "$short" in
|
||||
t)
|
||||
echo "$track $(git describe "refs/heads/$track")"
|
||||
;;
|
||||
*)
|
||||
v= n= r=
|
||||
eval $(git describe "refs/heads/$track" | sed -e "$parse_version")
|
||||
|
||||
echo "* $v..$track"
|
||||
case "$n" in
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
git --no-pager shortlog --no-merges "$v..$track"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
done
|
||||
35
TODO
35
TODO
@@ -1,35 +0,0 @@
|
||||
The GIT To-Do File
|
||||
==================
|
||||
|
||||
The latest copy of this document is found at
|
||||
|
||||
http://kernel.org/git/?p=git/git.git;a=blob;hb=todo;f=TODO
|
||||
http://repo.or.cz/w/alt-git.git?a=blob;hb=todo;f=TODO
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
gmane=http://thread.gmane.org/gmane.comp.version-control.git/
|
||||
|
||||
* Teach pack protocol to transfer estimated pack size and history
|
||||
depth to allow receiving end make more intelligent decision between
|
||||
unpack-objects and index-pack.
|
||||
|
||||
$gmane/173610
|
||||
|
||||
* Audit use of symbolic-ref without -m in our scripts and for each
|
||||
case decide if leaving a reflog entry for the HEAD is desirable.
|
||||
If so, add them.
|
||||
|
||||
$gmane/172516
|
||||
|
||||
* "git status" on intent-to-add index entries (say "I" in the first
|
||||
column instead of "A" for short status, add "(needs 'git add')" at the
|
||||
end of "new file: $path " in long status).
|
||||
|
||||
$gmane/170658
|
||||
|
||||
* synopsys: use {} instead of () for grouping alternatives (Jari Aalto)
|
||||
$gmane/72243
|
||||
|
||||
* "[alias] st = status" and "cd .git && git st" (Jeff King)
|
||||
$gmane/72327
|
||||
248
UWC
248
UWC
@@ -1,248 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Update an older edition of What's Cooking with the latest data.
|
||||
#
|
||||
# Usage: UWC [--keep-master] [ old [ new ] ]
|
||||
#
|
||||
# Giving no parameter is the same as giving a single "-" to the command.
|
||||
#
|
||||
# The command reads the old edition of (annotated) "What's Cooking"
|
||||
# message from "old", and "new". If "old" is "-", it is read from
|
||||
# the standard input. If "new" is not specified, WC script is run
|
||||
# and its output is used.
|
||||
#
|
||||
# An annotated "What's Cooking" message can have group header (a line
|
||||
# that has the group name enclosed in "[" and "]"), and annotatation
|
||||
# paragraphs after each topic's commit list, in addition to the bare
|
||||
# "WC" output.
|
||||
#
|
||||
# The group headers, topics in each group and their order in the group,
|
||||
# and annotation to topics are preserved from the "old" message. The
|
||||
# list of commits in each topic is replaced with the one taken from the
|
||||
# "new" message. Any topic in "new" that did not exist in "old" appear
|
||||
# in "New Topics" group. Also, topics that do not appear in the "new"
|
||||
# message are marked with <<deleted>>, topics whose commit list are
|
||||
# different from "old" are marked with <<updated from...>>>.
|
||||
#
|
||||
# Typically the maintainer would place the What's Cooking message
|
||||
# previously sent in a buffer in Emacs, and filter the buffer contents
|
||||
# with this script, to prepare an up-to-date message.
|
||||
|
||||
my $keep_master = 1;
|
||||
|
||||
sub parse_whats_cooking {
|
||||
my ($fh) = @_;
|
||||
my $head = undef;
|
||||
my $group = undef;
|
||||
my %wc = ("group list" => [], "topic hash" => {});
|
||||
my $topic;
|
||||
my $skipping_comment = 0;
|
||||
|
||||
while (<$fh>) {
|
||||
if (/^-{40,}$/) {
|
||||
# Group separator
|
||||
next;
|
||||
}
|
||||
|
||||
if (!defined $head) {
|
||||
if (/^Here are the topics that have been/) {
|
||||
$head = $_;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
if (/^<<.*>>$/) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($skipping_comment) {
|
||||
if (/^>>$/) {
|
||||
$skipping_comment = 0;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
if (!$skipping_comment && /^<</) {
|
||||
$skipping_comment = 1;
|
||||
next;
|
||||
}
|
||||
|
||||
if (/^\[(.*)\]$/) {
|
||||
$group = $1;
|
||||
push @{$wc{"group list"}}, $group;
|
||||
$wc{" $group"} = [];
|
||||
$topic = undef;
|
||||
next;
|
||||
}
|
||||
|
||||
if (!defined $group) {
|
||||
if (/^\* (\S+) (\(.*\) \d+ commits?)$/) {
|
||||
# raw output
|
||||
$group = "Misc";
|
||||
push @{$wc{"group list"}}, $group;
|
||||
$wc{" $group"} = [];
|
||||
} else {
|
||||
$head .= $_;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
if (/^\* (\S+) (\(.*\) \d+ commits?)$/) {
|
||||
$topic = +{
|
||||
topic => $1,
|
||||
head => $_,
|
||||
names => "",
|
||||
text => "",
|
||||
};
|
||||
$wc{"topic hash"}{$topic->{"topic"}} = $topic;
|
||||
push @{$wc{" $group"}}, $topic;
|
||||
next;
|
||||
}
|
||||
|
||||
if (/^ [-+.?*] / || /^ \S/) {
|
||||
$topic->{"names"} .= $_;
|
||||
next;
|
||||
}
|
||||
$topic->{"text"} .= $_;
|
||||
}
|
||||
|
||||
for ($head) {
|
||||
s/\A\s+//s;
|
||||
s/\s+\Z//s;
|
||||
}
|
||||
$wc{"head text"} = $head;
|
||||
for $topic (values %{$wc{"topic hash"}}) {
|
||||
for ($topic->{"text"}) {
|
||||
s/\A\s+//s;
|
||||
s/\s+\Z//s;
|
||||
}
|
||||
}
|
||||
return \%wc;
|
||||
}
|
||||
|
||||
sub print_whats_cooking {
|
||||
my ($wc) = @_;
|
||||
|
||||
print $wc->{"head text"}, "\n";
|
||||
|
||||
for my $group (@{$wc->{"group list"}}) {
|
||||
print "\n", "-" x 64, "\n";
|
||||
print "[$group]\n";
|
||||
for my $topic (@{$wc->{" $group"}}) {
|
||||
next if ($topic->{"head"} eq '');
|
||||
print "\n", $topic->{"head"};
|
||||
print $topic->{"names"};
|
||||
if ($topic->{"text"} ne '') {
|
||||
print "\n", $topic->{"text"}, "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub delete_topic {
|
||||
my ($wc, $topic) = @_;
|
||||
$topic->{"status"} = "deleted";
|
||||
}
|
||||
|
||||
sub merge_whats_cooking {
|
||||
my ($old_wc, $new_wc) = @_;
|
||||
my $group;
|
||||
my @gone = ();
|
||||
|
||||
for $group (@{$old_wc->{"group list"}}) {
|
||||
for my $topic (@{$old_wc->{" $group"}}) {
|
||||
my $name = $topic->{"topic"};
|
||||
my $newtopic = delete $new_wc->{"topic hash"}{$name};
|
||||
|
||||
if (!defined $newtopic) {
|
||||
push @gone, +{ @{[ %$topic ]} };
|
||||
$topic->{"text"} = "";
|
||||
$topic->{"names"} = "";
|
||||
$topic->{"head"} = "";
|
||||
next;
|
||||
}
|
||||
if (($newtopic->{"names"} ne $topic->{"names"}) ||
|
||||
($newtopic->{"head"} ne $topic->{"head"})) {
|
||||
my $text = ("<<updated from\n" .
|
||||
$topic->{"head"} .
|
||||
$topic->{"names"} . ">>");
|
||||
|
||||
if ($topic->{"text"} ne '') {
|
||||
$text .= "\n\n" . $topic->{"text"};
|
||||
}
|
||||
for ($text) {
|
||||
s/\A\s+//s;
|
||||
s/\s+\Z//s;
|
||||
}
|
||||
$topic->{"text"} = $text;
|
||||
$topic->{"names"} = $newtopic->{"names"};
|
||||
$topic->{"head"} = $newtopic->{"head"};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$group = 'Graduated to "master"';
|
||||
if (!$keep_master) {
|
||||
print STDERR "Not Keeping Master\n";
|
||||
my $o = delete $old_wc->{" $group"};
|
||||
for (@$o) {
|
||||
print STDERR " Dropping: ", $_->{'topic'}, "\n";
|
||||
}
|
||||
print STDERR "Gone are\n";
|
||||
for (@gone) {
|
||||
print STDERR " Gone: ", $_->{'topic'}, "\n";
|
||||
}
|
||||
}
|
||||
if (@gone) {
|
||||
if (!exists $old_wc->{" $group"}) {
|
||||
unshift @{$old_wc->{"group list"}}, $group;
|
||||
$old_wc->{" $group"} = [];
|
||||
}
|
||||
push @{$old_wc->{" $group"}}, @gone;
|
||||
}
|
||||
if (%{$new_wc->{"topic hash"}}) {
|
||||
$group = "New Topics";
|
||||
if (!exists $old_wc->{" $group"}) {
|
||||
unshift @{$old_wc->{"group list"}}, $group;
|
||||
$old_wc->{" $group"} = [];
|
||||
}
|
||||
for my $topic (values %{$new_wc->{"topic hash"}}) {
|
||||
my $name = $topic->{"topic"};
|
||||
$old_wc->{"topic hash"}{$name} = $topic;
|
||||
push @{$old_wc->{" $group"}}, $topic;
|
||||
$topic->{"text"} = $topic->{"text"};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (@ARGV == 0) {
|
||||
@ARGV = ('-');
|
||||
} elsif ($ARGV[0] eq '--keep-master') {
|
||||
$keep_master = 1;
|
||||
shift;
|
||||
}
|
||||
if (@ARGV != 2 && @ARGV != 1) {
|
||||
die "Usage: $0 old [new]\n";
|
||||
}
|
||||
|
||||
my ($old_wc, $new_wc);
|
||||
|
||||
if ($ARGV[0] eq '-') {
|
||||
*FH = *STDIN;
|
||||
} else {
|
||||
open FH, "$ARGV[0]";
|
||||
}
|
||||
$old_wc = parse_whats_cooking(\*FH);
|
||||
close FH;
|
||||
|
||||
if (@ARGV > 1) {
|
||||
open FH, "$ARGV[1]";
|
||||
} else {
|
||||
open FH, "Meta/WC generate |";
|
||||
}
|
||||
$new_wc = parse_whats_cooking(\*FH);
|
||||
close FH;
|
||||
|
||||
merge_whats_cooking($old_wc, $new_wc);
|
||||
print_whats_cooking($old_wc);
|
||||
56
WC
56
WC
@@ -1,56 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Prepare "What's cooking in git.git"
|
||||
|
||||
master_at=$(git rev-parse --verify refs/heads/master)
|
||||
next_at=$(git rev-parse --verify refs/heads/next)
|
||||
|
||||
keep_master=
|
||||
case "$1" in
|
||||
generate)
|
||||
echo Here are the topics that have been
|
||||
echo
|
||||
Meta/git-topic.perl --base=master | sed -e 's/^\*./\n*/'
|
||||
exit
|
||||
;;
|
||||
keep)
|
||||
keep_master=--keep-master
|
||||
;;
|
||||
esac
|
||||
|
||||
eval $(LC_ALL=C date +"monthname=%b month=%m year=%Y date=%d dow=%a")
|
||||
|
||||
lead="whats/cooking/$year/$month"
|
||||
issue=$(
|
||||
cd Meta &&
|
||||
git ls-tree -r --name-only HEAD "$lead" | tail -n 1
|
||||
)
|
||||
if test -n "$issue"
|
||||
then
|
||||
issue=$( expr "$issue" : '.*/0*\([1-9][0-9]*\)\.txt$' )
|
||||
issue=$(( $issue + 1 ))
|
||||
else
|
||||
issue=1
|
||||
fi
|
||||
issue=$( printf "%02d" $issue )
|
||||
mkdir -p "Meta/$lead"
|
||||
|
||||
exec >"Meta/$lead/$issue.txt"
|
||||
|
||||
cat <<EOF
|
||||
To: git@vger.kernel.org
|
||||
Subject: What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
|
||||
X-master-at: $master_at
|
||||
X-next-at: $next_at
|
||||
|
||||
What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
|
||||
--------------------------------------------------
|
||||
|
||||
EOF
|
||||
|
||||
last=$(
|
||||
cd Meta &&
|
||||
git ls-tree -r --name-only HEAD "whats/cooking" | tail -n 1
|
||||
)
|
||||
|
||||
sed -e 's/^\[New Topics\]$/[Old New Topics]/' "Meta/$last" |
|
||||
Meta/UWC $keep_master
|
||||
76
WI
76
WI
@@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Prepare "What's in git.git"
|
||||
|
||||
maint_at=$(git rev-parse --verify refs/heads/maint)
|
||||
master_at=$(git rev-parse --verify refs/heads/master)
|
||||
maint_was=$(git rev-parse --verify refs/hold/sa/maint)
|
||||
master_was=$(git rev-parse --verify refs/hold/sa/master)
|
||||
|
||||
log () {
|
||||
git shortlog -w76,2,4 --no-merges "$@"
|
||||
}
|
||||
|
||||
one () {
|
||||
git show -s --pretty="format:%h (%s)" "$1"
|
||||
}
|
||||
|
||||
eval $(LC_ALL=C date +"monthname=%b month=%m year=%Y date=%d dow=%a")
|
||||
|
||||
lead="whats/in/$year/$month"
|
||||
issue=$(
|
||||
cd Meta &&
|
||||
git ls-tree -r --name-only HEAD "$lead" | tail -n 1
|
||||
)
|
||||
if test -n "$issue"
|
||||
then
|
||||
issue=$( expr "$issue" : '.*/0*\([1-9][0-9]*\)\.txt$' )
|
||||
issue=$(( $issue + 1 ))
|
||||
else
|
||||
issue=1
|
||||
fi
|
||||
issue=$( printf "%02d" $issue )
|
||||
|
||||
mkdir -p "Meta/$lead"
|
||||
exec >"Meta/$lead/$issue.txt"
|
||||
|
||||
cat <<EOF
|
||||
To: git@vger.kernel.org
|
||||
Subject: What's in git.git ($monthname $year, #$issue; $dow, $date)
|
||||
X-maint-at: $maint_at
|
||||
X-master-at: $master_at
|
||||
X-maint-was: $maint_was
|
||||
X-master-was: $master_was
|
||||
|
||||
What's in git.git ($monthname $year, #$issue; $dow, $date)
|
||||
|
||||
maint $(one maint)
|
||||
master $(one master)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
BLURB HERE
|
||||
EOF
|
||||
|
||||
tagged=`git rev-parse --not --verify hold/sa/maint`
|
||||
list=`git rev-list $tagged refs/heads/maint 2>/dev/null`
|
||||
a=
|
||||
if test -n "$list"
|
||||
then
|
||||
echo
|
||||
echo "* The 'maint' branch has these fixes since the last announcement."
|
||||
echo
|
||||
log $tagged heads/maint
|
||||
a='
|
||||
in addition to the above.'
|
||||
else
|
||||
a=.
|
||||
fi
|
||||
|
||||
tagged=`git rev-parse --not --verify hold/sa/master`
|
||||
list=`git rev-list $tagged refs/heads/master 2>/dev/null`
|
||||
if test -n "$list"
|
||||
then
|
||||
echo
|
||||
echo "* The 'master' branch has these since the last announcement$a"
|
||||
echo
|
||||
log $tagged heads/master ^heads/maint
|
||||
fi
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
LC_ALL=C LANG=C
|
||||
export LC_ALL LANG
|
||||
|
||||
fmt="%-10s | %7d %7d %7d | %7d %7d | %-10s\n"
|
||||
hfmt=$(printf "%s" "$fmt" | sed -e 's/d/s/g')
|
||||
head=$(printf "$hfmt" release new this total this total date)
|
||||
|
||||
old= ocommitcnt=
|
||||
git for-each-ref --format='%(refname:short)' refs/tags/ |
|
||||
perl -w -e '
|
||||
use strict;
|
||||
my @version = ();
|
||||
my %asked = map { $_ => $_ } @ARGV;
|
||||
|
||||
while (<STDIN>) {
|
||||
next unless (/^(v(\d+)\.(\d+)(?:\.(\d+))?(?:-rc(\d+))?)$/);
|
||||
# $1 = tag == v$2.$3(.$4)?(-rc$5)?
|
||||
|
||||
if (exists $asked{$1}) {
|
||||
; # ok
|
||||
} elsif (defined $5) {
|
||||
# skip -rc releases
|
||||
next;
|
||||
} elsif ($2 == 0) {
|
||||
# not worth showing breakdown during v0.99 period
|
||||
next unless ($1 eq "v0.99");
|
||||
} elsif ($2 == 1) {
|
||||
# not worth showing breakdown before v1.4.0
|
||||
next if ($3 < 4 && $4);
|
||||
}
|
||||
push @version, [$1, $2, $3, $4, $5];
|
||||
}
|
||||
for (sort { (
|
||||
$a->[1] <=> $b->[1] ||
|
||||
$a->[2] <=> $b->[2] ||
|
||||
$a->[3] <=> $b->[3] ||
|
||||
( (defined $a->[4] && defined $b->[4])
|
||||
? $a->[4] <=> $b->[4]
|
||||
: defined $a->[4]
|
||||
? -1 : 1 ) ); } @version) {
|
||||
print $_->[0], "\n";
|
||||
}
|
||||
' "$@" |
|
||||
while read new
|
||||
do
|
||||
commitcnt=$(git rev-list --no-merges "$new" | wc -l)
|
||||
git shortlog -s -n "$new" |
|
||||
sed -e 's/^[ 0-9]*//' |
|
||||
sort >/var/tmp/new
|
||||
if test -n "$old"
|
||||
then
|
||||
comm -13 /var/tmp/old /var/tmp/new >"/var/tmp/cont-$new"
|
||||
i=$(git shortlog -s -n "$old..$new" |
|
||||
sed -e 's/^[ 0-9]*//' |
|
||||
wc -l)
|
||||
cc=$(( $commitcnt - $ocommitcnt ))
|
||||
else
|
||||
i=$(wc -l </var/tmp/new)
|
||||
cat /var/tmp/new >"/var/tmp/cont-$new"
|
||||
cc=$(( $commitcnt + 0 ))
|
||||
fi
|
||||
old=$new
|
||||
mv /var/tmp/new /var/tmp/old
|
||||
n=$(wc -l <"/var/tmp/cont-$new")
|
||||
c=$(wc -l <"/var/tmp/old")
|
||||
t=$(git show -s --format="%ci" "$old^0" | sed -e "s/ .*//")
|
||||
ocommitcnt=$commitcnt
|
||||
test -z "$head" || echo "$head"
|
||||
printf "$fmt" $new $n $i $c $cc $commitcnt $t
|
||||
head=
|
||||
done
|
||||
@@ -1,102 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
print <<'EOF' ;
|
||||
<a href="http://3.bp.blogspot.com/-zbY2zfS4fKE/TlgfTSTK-oI/AAAAAAAACOQ/E_0Y4408QRE/s1600/GprofileSmall.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="http://3.bp.blogspot.com/-zbY2zfS4fKE/TlgfTSTK-oI/AAAAAAAACOQ/E_0Y4408QRE/s1600/GprofileSmall.png"></a>
|
||||
<style>
|
||||
div.inset {
|
||||
background: #aff;
|
||||
color: #888;
|
||||
margin-left: 10%;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 2em;
|
||||
width: 60%;
|
||||
padding: 1.2em;
|
||||
}
|
||||
div.inset {
|
||||
color: #444;
|
||||
}
|
||||
div.inset a {
|
||||
color: #444;
|
||||
}
|
||||
div.inset a:hover {
|
||||
color: #00f;
|
||||
}
|
||||
h2 {
|
||||
text-decoration: underline;
|
||||
color: #888;
|
||||
}
|
||||
span.tt {
|
||||
font-family: monospace;
|
||||
}
|
||||
img#ohloh-badge, img#git {
|
||||
border: none;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
EOF
|
||||
|
||||
sub show_links {
|
||||
local ($_) = @_;
|
||||
my $br = '';
|
||||
for (split(/\n/, $_)) {
|
||||
s/^\s*//;
|
||||
s/\s*\Z//;
|
||||
my $url = $_;
|
||||
my $comment = $_;
|
||||
$url =~ s/ .*//;
|
||||
if ($url =~ /^http:/) {
|
||||
print "$br<a href=\"$url\"\n>$comment</a>";
|
||||
} else {
|
||||
print "$br$comment";
|
||||
}
|
||||
$br = "<br />\n";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
sub show_commands {
|
||||
local ($_) = @_;
|
||||
my $br = '';
|
||||
for (split(/\n/, $_)) {
|
||||
s/^\s*//;
|
||||
s/\s*\Z//;
|
||||
print "$br<span class=\"tt\">$_</span>";
|
||||
$br = "<br />\n";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
my $in_ul;
|
||||
$/ = "";
|
||||
while (<>) {
|
||||
$_ =~ s/\n+$//s;
|
||||
|
||||
if (/^ - /) {
|
||||
if (!$in_ul) {
|
||||
$in_ul = 1;
|
||||
print "<ul>\n";
|
||||
}
|
||||
s/^ - //;
|
||||
print "<li>$_</li>\n";
|
||||
next;
|
||||
}
|
||||
|
||||
if ($in_ul) {
|
||||
$in_ul = undef;
|
||||
print "</ul>\n\n";
|
||||
}
|
||||
|
||||
if (s/^\*\s*//) {
|
||||
print "<h2>$_</h2>\n\n";
|
||||
} elsif (s/^ {4,}//) {
|
||||
print "<div class=\"inset\">\n";
|
||||
if (/^(http|git|nntp):\/\//) {
|
||||
show_links($_);
|
||||
} else {
|
||||
show_commands($_);
|
||||
}
|
||||
print "</div>\n\n";
|
||||
} else {
|
||||
print "<p>$_</p>\n\n";
|
||||
}
|
||||
}
|
||||
218
git-topic.perl
218
git-topic.perl
@@ -1,218 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (c) 2006 Junio C Hamano
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
my $topic_pattern = '??*/*';
|
||||
my $base = 'next';
|
||||
my @stage = qw(next seen);
|
||||
my @mark = ('.', '?', '-', '+');
|
||||
my $all = 0;
|
||||
my $merges = 0;
|
||||
my $tests = 0;
|
||||
|
||||
my @custom_stage;
|
||||
my @custom_mark;
|
||||
GetOptions("topic=s" => \$topic_pattern,
|
||||
"base=s" => \$base,
|
||||
"stage=s" => \@custom_stage,
|
||||
"mark=s" => \@custom_mark,
|
||||
"merges!" => \$merges,
|
||||
"tests!" => \$tests,
|
||||
"all!" => \$all)
|
||||
or die;
|
||||
|
||||
if (@custom_stage) { @stage = @custom_stage; }
|
||||
if (@custom_mark) { @mark = @custom_mark; }
|
||||
my @nomerges = $merges ? qw(--no-merges) : ();
|
||||
|
||||
sub read_revs_short {
|
||||
my (@args) = @_;
|
||||
my @revs;
|
||||
open(REVS, '-|', qw(git rev-list), @nomerges, @args)
|
||||
or die;
|
||||
while (<REVS>) {
|
||||
chomp;
|
||||
push @revs, $_;
|
||||
}
|
||||
close(REVS);
|
||||
return @revs;
|
||||
}
|
||||
|
||||
sub read_revs {
|
||||
my ($bottom, $top, $mask) = @_;
|
||||
my @revs;
|
||||
open(REVS, '-|', qw(git rev-list --pretty=oneline), @nomerges,
|
||||
"$bottom..$top")
|
||||
or die;
|
||||
while (<REVS>) {
|
||||
chomp;
|
||||
my ($sha1, $topic) = /^([0-9a-f]{40}) (.*)$/;
|
||||
push @revs, [$sha1, $topic, $mask];
|
||||
}
|
||||
close(REVS);
|
||||
return @revs;
|
||||
}
|
||||
|
||||
sub rebase_marker {
|
||||
my ($topic, $stage, $in_next) = @_;
|
||||
my @not_in_topic = read_revs_short('^master', "^$topic", "$stage");
|
||||
|
||||
# @$in_next is what is in $stage but not in $base.
|
||||
# @not_in_topic excludes what came from $topic from @$in_next.
|
||||
# $topic can be rebased if these two set matches, because
|
||||
# no commits in $topic has been merged to $stage yet.
|
||||
if (@not_in_topic != @$in_next) {
|
||||
# we cannot rebase it anymore
|
||||
return ' ';
|
||||
}
|
||||
if (read_revs_short('master', "^$topic")) {
|
||||
# there is something that is in master but not in topic.
|
||||
return '^';
|
||||
}
|
||||
# topic is up to date.
|
||||
return '*';
|
||||
}
|
||||
|
||||
my %atlog_next = ();
|
||||
my %atlog_test = ();
|
||||
|
||||
sub next_marker {
|
||||
my ($topic) = @_;
|
||||
return '' if (!$tests);
|
||||
return '??' if (!exists $atlog_next{$topic});
|
||||
for ($atlog_next{$topic}) {
|
||||
my ($merge, $test) = ('*', '*');
|
||||
if (/rerere ok/) {
|
||||
$merge = 'R';
|
||||
} elsif (/conflict (\d+)/) {
|
||||
if ($1 < 10) {
|
||||
$merge = $1;
|
||||
} else {
|
||||
$merge = 'X';
|
||||
}
|
||||
}
|
||||
$test = 'X' if (/test error/);
|
||||
return "$merge$test";
|
||||
}
|
||||
}
|
||||
|
||||
sub test_marker {
|
||||
my ($commit) = @_;
|
||||
return '' if (!$tests);
|
||||
my $tree = `git rev-parse "$commit^{tree}"`;
|
||||
chomp($tree);
|
||||
return "?" if (!exists $atlog_test{$tree});
|
||||
for ($atlog_test{$tree}) {
|
||||
if (/build error/) {
|
||||
return 'B';
|
||||
} elsif (/test error/) {
|
||||
return 'X';
|
||||
} else {
|
||||
return ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub describe_topic {
|
||||
my ($topic) = @_;
|
||||
|
||||
open(CONF, '-|', qw(git repo-config --get),
|
||||
"branch.$topic.description")
|
||||
or die;
|
||||
my $it = join('',<CONF>);
|
||||
close(CONF);
|
||||
chomp($it);
|
||||
if ($it) {
|
||||
wrap_print(" $it");
|
||||
}
|
||||
}
|
||||
|
||||
my @in_next = read_revs_short('^master', $stage[0]);
|
||||
my @topic = ();
|
||||
|
||||
my @topic_pattern = map { "refs/heads/$_" } (@ARGV ? @ARGV : $topic_pattern);
|
||||
|
||||
open(TOPIC, '-|', qw(git for-each-ref),
|
||||
'--sort=-authordate',
|
||||
'--format=%(objectname) %(authordate) %(refname)',
|
||||
@topic_pattern)
|
||||
or die;
|
||||
|
||||
while (<TOPIC>) {
|
||||
chomp;
|
||||
my ($sha1, $date, $topic) = m|^([0-9a-f]{40})\s(.*?)\srefs/heads/(.+)$|
|
||||
or next;
|
||||
push @topic, [$sha1, $date, $topic];
|
||||
}
|
||||
close(TOPIC);
|
||||
|
||||
if (open(AT, "Meta/AT.log")) {
|
||||
my $next = `git rev-parse --verify refs/heads/next`;
|
||||
chomp $next;
|
||||
while (<AT>) {
|
||||
if (/^N (.{40}) (.{40}) (.*)$/ && $1 eq $next) {
|
||||
$atlog_next{$2} = $3;
|
||||
next;
|
||||
}
|
||||
if (/^A (.{40}) (.*)/) {
|
||||
$atlog_test{$1} = $2;
|
||||
next;
|
||||
}
|
||||
}
|
||||
close(AT);
|
||||
}
|
||||
|
||||
my @last_merge_to_next = ();
|
||||
|
||||
for (@topic) {
|
||||
my ($sha1, $date, $topic) = @$_;
|
||||
my @revs = read_revs($base, $sha1, (1<<@stage)-1);
|
||||
next unless (@revs || $all);
|
||||
|
||||
my %revs = map { $_->[0] => $_ } @revs; # fast index
|
||||
for (my $i = 0; $i < @stage; $i++) {
|
||||
for my $item (read_revs_short("^$stage[$i]", $sha1)) {
|
||||
if (exists $revs{$item}) {
|
||||
$revs{$item}[2] &= ~(1 << $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '*' .
|
||||
next_marker($sha1) .
|
||||
rebase_marker($sha1, $stage[0], \@in_next);
|
||||
my $count = "";
|
||||
if (1 < @revs) {
|
||||
$count = " " . (scalar @revs) . " commits";
|
||||
}
|
||||
elsif (@revs) {
|
||||
$count = " 1 commit";
|
||||
}
|
||||
print " $topic ($date)$count\n";
|
||||
describe_topic($topic);
|
||||
for my $item (@revs) {
|
||||
my $mark = $item->[2];
|
||||
if ($mark < @mark) {
|
||||
$mark = $mark[$mark];
|
||||
}
|
||||
if ($tests) {
|
||||
$mark = test_marker($item->[0]) . $mark;
|
||||
}
|
||||
wrap_print("$mark $item->[1]");
|
||||
}
|
||||
}
|
||||
|
||||
sub wrap_print {
|
||||
my ($string) = @_;
|
||||
format STDOUT =
|
||||
~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
$string
|
||||
~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
$string
|
||||
.
|
||||
write;
|
||||
}
|
||||
Reference in New Issue
Block a user