First check in
This commit is contained in:
3
SRC/patches/README
Normal file
3
SRC/patches/README
Normal file
@@ -0,0 +1,3 @@
|
||||
Place any patch files here and preface each with a
|
||||
number indicating the order of execution. Patch
|
||||
files are expected to use a .patch extension.
|
||||
79
SRC/snap-tools/gitlist
Executable file
79
SRC/snap-tools/gitlist
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
#for b in `git branch --no-color|sed 's/.* //'`; do echo [$b]; for t in `git tag`; do if git branch --contains $t|sed 's/.* //'|grep -q ^$b\$; then echo " $t"; fi; done; done
|
||||
|
||||
sub gitbranches {
|
||||
( my $dir = shift ) =~ s/\/$//;
|
||||
my $branches = {};
|
||||
my $cmd = "git --git-dir=\"$dir/.git\" --work-tree=\"$dir\""
|
||||
. " branch --no-color";
|
||||
|
||||
open( my $git, "$cmd|" ) || die( $! );
|
||||
|
||||
while ( <$git> ) {
|
||||
chomp();
|
||||
|
||||
if ( $_ =~ /\s*\*?\s*(.*)$/ ) {
|
||||
$branches->{$1} = [];
|
||||
}
|
||||
}
|
||||
|
||||
close( $git );
|
||||
|
||||
return( $branches );
|
||||
}
|
||||
|
||||
sub gitcontains {
|
||||
( my $dir = shift ) =~ s/\/$//;
|
||||
my $branches = gitbranches( $dir );
|
||||
my $tags = gittags( $dir );
|
||||
|
||||
foreach my $tag ( @$tags ) {
|
||||
my $cmd = "git --git-dir=\"$dir/.git\" --work-tree=\"$dir\""
|
||||
. " branch --contains \"$tag\"";
|
||||
|
||||
open( my $git, "$cmd|" ) || die( $! );
|
||||
|
||||
while ( <$git> ) {
|
||||
chomp();
|
||||
|
||||
if ( $_ =~ /\s*\*?\s*(.*)$/ ) {
|
||||
push( @{$branches->{$1}}, $tag );
|
||||
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return( $branches );
|
||||
}
|
||||
|
||||
sub gittags {
|
||||
( my $dir = shift ) =~ s/\/$//;
|
||||
my $tags = [];
|
||||
my $cmd = "git --git-dir=\"$dir/.git\" --work-tree=\"$dir\" tag";
|
||||
|
||||
open( my $git, "$cmd|" ) || die( $! );
|
||||
|
||||
while ( <$git> ) {
|
||||
chomp();
|
||||
|
||||
push( @$tags, $_ );
|
||||
}
|
||||
|
||||
close( $git );
|
||||
|
||||
return( $tags );
|
||||
}
|
||||
|
||||
my $branches = gitcontains( $ARGV[0] );
|
||||
|
||||
foreach my $branch ( sort( keys( %$branches ) ) ) {
|
||||
print "[$branch]\n";
|
||||
|
||||
foreach my $tag ( @{$branches->{$branch}} ) {
|
||||
print " $tag\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user