head	1.15;
access;
symbols;
locks; strict;
comment	@# @;


1.15
date	2000.02.13.04.14.21;	author peter;	state dead;
branches;
next	1.14;

1.14
date	99.09.19.13.11.03;	author peter;	state Exp;
branches;
next	1.13;

1.13
date	99.08.27.22.46.56;	author peter;	state Exp;
branches;
next	1.12;

1.12
date	97.06.08.02.09.37;	author peter;	state Exp;
branches;
next	1.11;

1.11
date	97.04.13.11.18.55;	author bde;	state Exp;
branches;
next	1.10;

1.10
date	96.02.07.14.35.36;	author peter;	state Exp;
branches;
next	1.9;

1.9
date	95.09.02.04.10.49;	author peter;	state Exp;
branches;
next	1.8;

1.8
date	95.08.28.12.14.04;	author rgrimes;	state Exp;
branches;
next	1.7;

1.7
date	95.08.27.23.07.50;	author peter;	state Exp;
branches;
next	1.6;

1.6
date	95.08.23.11.42.34;	author peter;	state Exp;
branches;
next	1.5;

1.5
date	95.08.13.16.38.07;	author peter;	state Exp;
branches;
next	1.4;

1.4
date	95.08.05.13.13.50;	author peter;	state Exp;
branches;
next	1.3;

1.3
date	95.08.05.10.58.54;	author peter;	state Exp;
branches;
next	1.2;

1.2
date	95.08.05.09.00.19;	author peter;	state Exp;
branches;
next	1.1;

1.1
date	95.08.05.05.41.00;	author peter;	state Exp;
branches;
next	;


desc
@@


1.15
log
@Remove this, it lives on in logcheck.
@
text
@#! /usr/bin/perl -w
#
# $FreeBSD: CVSROOT/cvsedit,v 1.14 1999/09/19 13:11:03 peter Exp $
# 
# This crude hack is to sanitise the results of what the user may have
# "done" while editing the commit log message.. :-)   Peter Wemm.
#
# To use this, make it executable, and set your editinfo DEFAULT line:
# DEFAULT   /path/to/this/program
#

# same rules as CVS
$editor="vi";
if (defined $ENV{'EDITOR'}) {		# $EDITOR overrides default
	$editor = $ENV{'EDITOR'};
}
if (defined $ENV{'CVSEDITOR'}) {	# $CVSEDITOR overrises $EDITOR
	$editor = $ENV{'CVSEDITOR'};
}

if (!@@ARGV) {
	die "Usage: cvsedit filename\n";
}
$filename = $ARGV[0];
$tmpfile = $filename . "tmp";

$retcode = system("$editor $filename");
$retcode /= 256;

if ($retcode) {
	# Kaboom!
	exit($retcode);
}

open(IN, "< $filename") ||
	die "cvsedit: Cannot open for reading: $filename: $!\n";

open(OUT, "> $tmpfile") ||
	die "cvsedit: Cannot open for writing: $tmpfile: $!\n";

# In-place edit the result of the user's edit on the file.
$blank = 0;	# true if the last line was blank
$first = 0;	# true if we have seen the first real text
while(<IN>) {

	# Dont let CVS: lines upset things, but maintain them in case
	# the editor is re-entered.  NO CHANGES!!
	if (/^CVS:/) {
		print OUT;
		next;
	}

	chop;		# strip trailing newline
	s/[\s]+$//;	# strip trailing whitespace

	# collapse multiple blank lines, and trailing blank lines.
	if (/^$/) {
		# Blank line. Remember in case more text follows.
		$blank = 1;
		next;
	} else {
		# Delete if they only have whitespace after them.
		if (/^PR:$/i ||
		    /^Reviewed by:$/i ||
		    /^Submitted by:$/i ||
		    /^Obtained from:$/i ||
		    /^CC:$/i) {
			next;
		}
		if ($blank && $first) {
			# Previous line(s) was blank, this isn't. Close the
			# collapsed section.
			print OUT "\n";
		}
		$blank = 0;	# record non-blank
		$first = 1;	# record first line
		print OUT "$_\n";
	}
}
close(IN);
close(OUT);

unlink($filename . "~");	# Nuke likely editor backups..
unlink($filename . ".bak");	# Nuke likely editor backups..

# Check to see if any differences.
$different = system("cmp -s $tmpfile $filename");

# Make a clean exit if there are no changes, or there is no 'text'
# - for example, a user quit the editor without saving.
# preserve stat() info if appropriate.
if (!$different || !$first) {
	unlink($tmpfile);
	exit(0);
}

rename("$tmpfile", "$filename") ||
	die("cvsedit: Could not rename $tmpfile to $filename: $!");

exit(0);
@


1.14
log
@Sync with internat.freebsd.org crypto repo.  (part 1)

Submitted by:	markm
@
text
@d3 1
a3 1
# $FreeBSD: CVSROOT/cvsedit,v 1.13 1999/08/27 22:46:56 peter Exp $
@


1.13
log
@$Id$ -> $FreeBSD$
@
text
@d1 1
a1 1
#! /usr/bin/perl
d3 1
a3 1
# $FreeBSD$
@


1.12
log
@Be more consistant with $Id$
@
text
@d3 1
a3 1
# $Id: cvsedit,v 1.11 1997/04/13 11:18:55 bde Exp $
@


1.11
log
@Edit out null `PR:'s
PR:
@
text
@d2 2
a9 2
#
# $Id: cvsedit,v 1.10 1996/02/07 14:35:36 peter Exp $
@


1.10
log
@Attempt to fix some outstanding bugs/misfeatures/bogons in the CVSROOT
code, as well as simplifying some admin procedures.

The main change is to stop multi-directory commits only having the subject
info of the last directory, and not being sent to all the lists, and not
being logged to the appropriate commitlogs.

updateCVSROOT is gone (yay!), it's functionality is replaced by a cvs-1.6
feature - the 'checkoutlist' file, which is designed explicitly for this.
This will stop the easy-import users from getting told the mailing list
is out of date when a committer has been added but had missed out on being
put on the cvs-committers mailing list.

Update the comments and info in the *info files with the cvs-1.6 headers,
this fixes a few typos, clarifys some things, corrects some misleading
comments, etc.

Some stub files added to indicate how new cvs-1.6+ functionality is used,
but left commented out (taginfo, cvswrappers, etc)

All hard-coded references to /home/ncvs are changed back to $CVSROOT
(as suggested to me by bde) now that cvs-1.6+ makes a special effort
to ensure $CVSROOT is always set.  This allows the $CVSROOT files to be
used elsewhere (eg: for testing) with much less pain.

mkavail is history as well, it was often being forgotten.  cvs-committers
now takes the user list from /etc/group:ncvs via a trivial perl script.
This is so that we still have the ability to temporarily disable commit
access via 'avail' without cutting off the cvs-committers mailing list.
Since /etc/group editing is still required, this is not a new admin
overhead.  If we ever change so that membership of "ncvs" is not required
(eg: /usr/bin/cvs becomes setgid and access control is via avail) then
we are going to have to do it some other way.  (I have ideas)

I have tested this on my machines, but it is possible that I have missed
something.  As usual, please yell if I've botched it.
@
text
@d9 1
a9 1
# $Id$
d63 2
a64 1
		if (/^Reviewed by:$/i ||
@


1.9
log
@Correct cvsedit so that it does the 'right thing' (TM) when the user
quits without saving.

Previously, it would cause cvs to abort the commit without giving
any warning.

Now, it does that cvs normally does when the user quits without saving,
ie: ask if you want to abort, or use the empty message, or re-edit.
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.8 1995/08/28 12:14:04 rgrimes Exp $
@


1.8
log
@Back out the very last change to this.  Go back to dieing
on empty log messages, far far better than allowing the commit.

I will have to wait to talk to Peter on a longer term fix.

Submitted by:	David Greenman
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.7 1995/08/27 23:07:50 peter Exp $
a81 5
# sanity check...
if (!$first) {
	die("cvsedit: Empty log message not permitted!\n");
}

d85 1
a85 1
# Check to see if any differences. preserve stat() info if not.
d87 5
a91 1
if (!$different) {
@


1.7
log
@Turn off bogus check for empty log messages that was tripping people up..

Reviewed by:	rgrimes
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.6 1995/08/23 11:42:34 peter Exp $
d83 3
a85 3
#if (!$first) {
#	die("cvsedit: Empty log message not permitted!\n");
#}
@


1.6
log
@Fix incorrect Regexp that zapped Satoshi's Submitted-by line.. :-(
This got past both Rod and I.. :-(
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.5 1995/08/13 16:38:07 peter Exp $
d83 3
a85 3
if (!$first) {
	die("cvsedit: Empty log message not permitted!\n");
}
@


1.5
log
@few hacks for CC line
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.4 1995/08/05 13:13:50 peter Exp $
d64 1
a64 1
		    /^Submitted by:/i ||
@


1.4
log
@get cvsedit to drop likely editor backup files
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.3 1995/08/05 10:58:54 peter Exp $
d63 4
a66 2
		if (/^Reviewed by:$/ || /^Submitted by:/ ||
		    /^Obtained from:$/) {
@


1.3
log
@correct the CVS: botch
CVS:
CVS:
@
text
@d9 1
a9 1
# $Id: cvsedit,v 1.2 1995/08/05 09:00:19 peter Exp $
a79 3
rename("$tmpfile", "$filename") ||
	die("cvsedit: Could not rename $tmpfile to $filename: $!");

d84 14
@


1.2
log
@'ere we go
@
text
@d9 1
a9 1
# $Id$
d45 8
a64 6
			next;
		}
		# Dont let CVS: lines upset things, but maintain them in case
		# the editor is re-entered.
		if (/^CVS:/) {
			print OUT "$_\n";
@


1.1
log
@Add modules, cvsedit
@
text
@d1 10
a10 3
#! /bin/sh
# CVS only passes one argument here.. the filename in /tmp...
ARG="$1"
d13 7
a19 3
ED="vi"
{ test -n "$EDITOR"; } && ED="$EDITOR"
{ test -n "$CVSEDITOR"; } && ED="$CVSEDITOR"
d21 19
a39 2
$EDITOR "$ARG"
EDSTATUS=$?
d42 38
a79 7
/usr/bin/perl -i -e '
while(<>) {
	# Delete the following lines if they only have whitespace after them.
	print unless /^Reviewed by:[\s]*$/ ||
		     /^Submitted by:[\s]*$/ ||
		     /^Obtained from:[\s]*$/;
}' "$ARG"
d81 5
a85 1
exit $EDSTATUS
@
