Whamcloud - gitweb
Add cvs management scripts to top-level repository.
[fs/lustre-release.git] / build / cvs-modified-files.pl
diff --git a/build/cvs-modified-files.pl b/build/cvs-modified-files.pl
new file mode 100755 (executable)
index 0000000..d13c4d3
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+my $mode = "NONE";
+my @modified, @added, @removed;
+
+while($line = <>) {
+  if ($line =~ /Modified Files:/) {
+    $mode = "MODIFIED";
+    next;
+  }
+
+  if ($line =~ /Added Files:/) {
+    $mode = "ADDED";
+    next;
+  }
+
+  if ($line =~ /Removed Files:/) {
+    $mode = "REMOVED";
+    next;
+  }
+
+  if ($mode eq "NONE") { next; }
+  if ($line =~ /-------/) { next; }
+
+  chop($line);
+  $line =~ s/^CVS:\s+//;
+  $line =~ s/\s+$//;
+  # print "processing $line for $mode\n";
+  @files = split(/ /, $line);
+  # print "new files for $mode: ", join(', ', @files), "\n";
+
+  if ($mode eq "MODIFIED") {
+    push(@modified, @files);
+  } elsif ($mode eq "ADDED") {
+    push(@added, @files);
+  } elsif ($mode eq "REMOVED") {
+    push(@removed, @files);
+  } else {
+    die "Unknown mode $mode!";
+  }
+}
+
+print join(' ', @modified);
+if ($ENV{"SHOW_ALL_FILES"} ne "no") {
+  print ' ', join(' ', @added), ' ', join(' ', @removed);
+}
+print "\n";