X-Git-Url: http://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fcvsutil;h=8457ee4228693352a9164deb552fddd1a854b3e0;hp=cd999a545108ae98d426151ae1dac4241aef2ee4;hb=0cc7abac77065b9d06676d386c08c128cf1983b9;hpb=a63b61163f2b94c6c3beaae9636b1d346e4e1bb2 diff --git a/bin/cvsutil b/bin/cvsutil index cd999a5..8457ee4 100755 --- a/bin/cvsutil +++ b/bin/cvsutil @@ -1,6 +1,14 @@ #! /usr/bin/perl # # $Id$ +# +# Recommended aliases: +# alias cvsfiles='cvsutil --files --print' +# alias cvsignores='cvsutil --ignores --print' +# alias cvsignoresall='cvsutil --ignores --workings --print' +# alias cvsignoresrm='cvsutil --ignores --rm' +# alias cvsignoresrmall='cvsutil --ignores --workings --rm' +# alias cvsignoresallrm='cvsutil --ignores --workings --rm' use strict; use warnings; @@ -120,6 +128,17 @@ sub localdircore fordirs \&localdir,@dir_dirs; } +sub filterout +{ +my($from,@what)=@_; + + my %hash=map { $_=>1; } @$from; + for (@what) { + delete $hash{$_}; + } + return keys %hash; +} + sub localreaddir { local *E; @@ -148,6 +167,7 @@ sub localreaddir } } close I; + @dir_ignores=filterout \@dir_ignores,@dir_dirs,@dir_files; } else { mayfatal "File \"".CVSIGNORE."\" cannot be opened" if !$!{ENOENT}; @@ -158,13 +178,8 @@ sub localreaddir mayfatal "Cannot read directory \".\""; return 0; } - @dir_workings=readdir D; + @dir_workings=filterout [readdir D],@dir_dirs,@dir_files,@dir_ignores,@all_ignore,".",".."; closedir D; - my %delworkings=map { $_=>1; } @dir_workings; - for (@dir_dirs,@dir_files,@dir_ignores,@all_ignore,".","..") { - delete $delworkings{$_}; - } - @dir_workings=keys %delworkings; return 1; }