Last active
December 17, 2015 07:39
-
-
Save noodles-v6/5574691 to your computer and use it in GitHub Desktop.
svn check status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@rem = '--*-Perl-*-- | |
@echo off | |
perl -x -S %0 %* | |
goto endofperl | |
@rem -- BEGIN PERL -- '; | |
#!perl | |
my @ignore_list = qw/ | |
svn_status_chk.bat | |
svn_update.bat | |
temp | |
Generated | |
cproject | |
build | |
main.trace | |
/; | |
# check svn status | |
my @lines = `svn status`; | |
my @ignore_files; | |
my @modify_files; | |
my @unadd_files; | |
my @unknown_files; | |
for my $line (@lines) { | |
chop $line; | |
chomp $line; | |
if ($line =~ /^(M|\?)\s+(.*)/) { | |
my $status = $1; | |
my $file = $2; | |
if( is_ignore($file) ) { | |
push @ignore_files, $line; | |
next; | |
} | |
if ($status =~ /^\?/) { | |
push @unadd_files, $line; | |
} elsif ($status =~ /^M/) { | |
push @modify_files, $line; | |
} else { | |
push @unknown_files, $line; | |
} | |
} | |
} | |
# dumper data | |
print "\n? (ignore) files\n"; | |
print "================\n"; | |
map { print $_, "\n" } @ignore_files; | |
print "\n? (un-added) files\n"; | |
print "==================\n"; | |
map { print $_, "\n" } @unadd_files; | |
print "\nM (modified) files\n"; | |
print "==================\n"; | |
map { print $_, "\n" } @modify_files; | |
print "\n? (unknown) files\n"; | |
print "==================\n"; | |
map { print $_, "\n" } @unknown_files; | |
print "\n"; | |
print scalar @ignore_files, " files < ignored > ", "\n", | |
scalar @unadd_files, " files < un-added >. ", "\n", | |
scalar @modify_files, " files < modified and uncommited >.","\n", | |
scalar @unknown_files," files < unknown >.", "\n", | |
"\n"; | |
sub is_ignore { | |
my $f = shift; | |
for $item (@ignore_list) { | |
chomp $item; | |
chomp $f; | |
return 1 if $f =~ /$item/; | |
} | |
0; | |
} | |
__END__ | |
:endofperl | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svn update | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment