[m-dev.] diff: use .nocopyright files to control copyright checks.

Tyson Dowd trd at cs.mu.OZ.AU
Thu Aug 17 13:14:49 AEST 2000


Hi,

I hope this works.  It works fine with local files and no CVS
interaction, but until I check it in I can't test it with client/server
CVS very easily.

===================================================================


Estimated hours taken: 0.5

Attempt to fix the problems with using remote CVS where the CVS server
assumes it can interact with you to resolve problems such as checking in
files that don't have copyright messages.

Now you should be able to add a file called `.nocopyright' to a
directory, with a filename on each line.  If a filename occurs in this
.nocopyright file, you don't have to copyright check that file.

I'm hoping this will be enough for client/server CVS to be able to read
the .nocopyright file, and so you can check in anything you like using
remote CVS by (at worst) adding the files to the .nocopyright file
first.  However it may turn out that with client/server CVS we need a
little more than that.

CVSROOT/check.pl:
	Move the copyright check into a subroutine.	
	Look in the current directory for the file .nocopyright, and if
	it contains the name of the file in question, don't check the
	copyright on this file.



Index: CVSROOT/check.pl
===================================================================
RCS file: /home/mercury1/repository/CVSROOT/check.pl,v
retrieving revision 1.12
diff -u -r1.12 check.pl
--- CVSROOT/check.pl	1999/07/27 21:50:25	1.12
+++ CVSROOT/check.pl	2000/08/17 03:02:50
@@ -91,7 +91,7 @@
 	# to include the current year.  But only for files within
 	# the `mercury' hierarchy.
 	#
-	next FILE unless ($directory =~ m^$ENV{CVSROOT}/mercury^);
+	next FILE unless (check_copyright($directory, $arg));
 	# print "checking copyright for `$arg' (from `$directory')\n";
 
 	open 'arg' or die "Error opening $arg: $!\n";
@@ -131,6 +131,26 @@
 	}
 }
 exit($retval);
+
+sub check_copyright {
+	my $directory = shift(@_);
+	my $file = shift(@_);
+	if ($directory =~ m^$ENV{CVSROOT}/mercury^) {
+		if (open NOCOPYRIGHT, ".nocopyright") {
+			while (<NOCOPYRIGHT>) {
+				if ($_ =~ /^$file/) {
+					print "no copyright check required for `$file' (from `$directory')\n";
+					return 0;
+				}
+			}
+		}
+		# print "checking copyright for `$file' (from `$directory')\n";
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
 
 sub query_force {
 	if (open TTY, "/dev/tty") {


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list