Include "rpm-qa" file.
[nethome.git] / bin / cvsutil
index cd999a5..8457ee4 100755 (executable)
@@ -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;
 }