Newsgroup: alt.sources


Article 984 of alt.sources:
Path: icdoc!ukc!mcsun!uunet!datapg!sewilco
>From: sewilco@datapg.MN.ORG (Scot E Wilcoxon)
Newsgroups: alt.sources
Subject: Tools for RCS
Message-ID: <23946@datapg.MN.ORG>
Date: 11 Dec 89 23:40:42 GMT
References: <342@capmkt.COM>
Reply-To: sewilco@DataPg.MN.ORG (Scot E Wilcoxon)
Followup-To: alt.sources.d
Distribution: alt
Organization: Data Progress, Minneapolis, MN
Lines: 408
Content-Length: 11583
[ Originally posted to comp.software-eng ]

>From: diomidis@ecrcvax.UUCP (Diomidis Spinellis)
Newsgroups: comp.software-eng
Subject: Re: Does anyone have tools for use with RCS that they can share?
Summary: Tools for RCS (rcstell, slist, rcsclean) (source and manual pages)
Keywords: RCS S-list shell script rcstell slist rcsclean
Message-ID: <755@ecrcvax.UUCP>
Date: 8 Aug 89 18:34:06 GMT
References: <342@capmkt.COM>
Reply-To: diomidis@ecrcvax.UUCP (Diomidis Spinellis)
Organization: ECRC, Munich 81, West Germany
Lines: 387
Posted: Tue Aug  8 19:34:06 1989

In article <342@capmkt.COM> brent@capmkt.COM (Brent Chapman) writes:
>It seems to me that many people and organizations, over the past few
>years, must have written tools to augment and compliment RCS.  If you
>have, I urge you to consider sharing your tools with the rest of us,
>before we all go out and "reinvent the wheel".
> [...]

I am including the source and manual pages for three tools that can be
helpful when using RCS.

- Rcstell reports files checked out as locked and optionaly their lockers.
- Slist helps creating S-lists, for sets of files, or executables.
- Rcsclean removes all files that can be recreated by RCS.

I have used these scripts over some time and they function for the style of
work I do.  They have not been tested in other working environments.

>-Brent
Diomidis

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	rcsclean
#	rcsclean.1
#	rcstell
#	rcstell.1
#	slist
#	slist.1
# This archive created: Mon Aug  7 17:00:49 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'rcsclean'" '(471 characters)'
if test -f 'rcsclean'
then
	echo shar: will not over-write existing file "'rcsclean'"
else
sed 's/^X//' << \SHAR_EOF > 'rcsclean'
X#!/bin/sh -
X#
X# Delete RCS files that can be safelly recreated by RCS using co.
X#
X# (C) Copyright 1989 Diomidis Spinellis.  All rights reserved.
X# Permission to copy for any purpose is hereby granted so long
X# as this copyright notice remains intact.
X#
Xrlog -h RCS/*,v *,v 2>/dev/null |
Xawk '
X/^RCS file:/ { fname = $6 }
X/^locks:/ { 
X	if( NF == 3 ) 
X		printf "test -r %s && co -p %s 2>/dev/null | diff - %s >/dev/null && rm '$*' %s\n", fname, fname, fname, fname
X}' |
Xsh
SHAR_EOF
if test 471 -ne "`wc -c < 'rcsclean'`"
then
	echo shar: error transmitting "'rcsclean'" '(should have been 471 characters)'
fi
chmod +x 'rcsclean'
fi # end of overwriting check
echo shar: extracting "'rcsclean.1'" '(1272 characters)'
if test -f 'rcsclean.1'
then
	echo shar: will not over-write existing file "'rcsclean.1'"
else
sed 's/^X//' << \SHAR_EOF > 'rcsclean.1'
X.\" Copyright (C) 1989 Diomidis Spinellis.  All rights reserved.
X.\" Permission to copy for any purpose is hereby granted so long
X.\" as this copyright notice remains intact.
X.\"
X.TH RCSCLEAN 1 "Jun 14, 1989"
X.UC 4
X.SH NAME
Xrcsclean \- delete files that can be recreated by co
X.SH SYNOPSIS
X.B rcsclean
X[
X.B rm options
X] 
X.br
X.SH DESCRIPTION
X.I Rcsclean
Xdeletes any files in the current directory that can be recreated
Xby checking out the latest version of the revision tree.
XIt is conservative in its approach, comparing only unlocked files ending in
X.I ,v
Xin the current and the
X.I './RCS'
Xdirectories against the working versions.
X.PP
XAny of the rm options can be given as options to
X.I rcsclean.
XIn particular the
X.B \-f
Xoption can be used to force the deletion of all files without 
Xasking and the
X.B \-i 
Xoption for interactive prompting before each deletion.
X.PP
X.SH FILES
X.I *,v RCS/*,v
XThe files examined.
X.SH AUTHOR
XDiomidis Spinellis (dds@cc.ic.ac.uk)
X.SH "SEE ALSO"
Xrcs(1), co (1), ci (1), rlog (1).
X.sp 0
XWalter F. Tichy, "Design, Implementation, and Evaluation of a Revision Control
XSystem," in \fIProceedings of the 6th International Conference on Software
XEngineering\fR, IEEE, Tokyo, Sept. 1982.
X.SH BUGS
XDepends a lot on the format of the
X.I rlog
Xoutput.
SHAR_EOF
if test 1272 -ne "`wc -c < 'rcsclean.1'`"
then
	echo shar: error transmitting "'rcsclean.1'" '(should have been 1272 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'rcstell'" '(918 characters)'
if test -f 'rcstell'
then
	echo shar: will not over-write existing file "'rcstell'"
else
sed 's/^X//' << \SHAR_EOF > 'rcstell'
X#!/bin/sh
X#
X# Tell what rcs files are currently being edited (ie. are `locked' out)
X#
X# (C) Copyright 1988 D. Spinellis. All rights reserved.
X# Permission to copy for any purpose is hereby granted so long
X# as this copyright notice remains intact.
X#
Xcase $# in
X0)
X	rlog -L -h RCS/*,v *,v 2>/dev/null |
X	sed -n -e '/^RCS file:/s/.*Working file:[ 	]*\(.*\)$/\1/p'
X	;;
X1)
X	case $1 in
X	-l)
X		rlog -L -h RCS/*,v *,v 2>/dev/null |
X		sed -n -e '
X		/^RCS file:/s/.*Working file:[ 	]*\(.*\)$/\1/p
X		/locks:/s/^locks:[	 ]*\([^:]*\):[ 	]\([^;]*\).*/\1 \2/p
X		' |
X		while read FNAME && read LOCKER REV
X		do
X			echo $FNAME $REV $LOCKER `
X				(
X					ypmatch $LOCKER passwd || 
X					egrep "^$LOCKER:" /etc/passwd
X				) 2>/dev/null | 
X				sed 's/[^:]*:[^:]*:[^:]*:[^:]*:\([^,:]*\).*$/(\1)/'
X			`
X		done
X		;;
X	*)
X		echo 1>&2 "Usage `basename $0` [-l]" ; exit 1
X		;;
X	esac
X	;;
X*)
X	echo 1>&2 "Usage `basename $0` [-l]" ; exit 1
X	;;
Xesac
SHAR_EOF
if test 918 -ne "`wc -c < 'rcstell'`"
then
	echo shar: error transmitting "'rcstell'" '(should have been 918 characters)'
fi
chmod +x 'rcstell'
fi # end of overwriting check
echo shar: extracting "'rcstell.1'" '(1231 characters)'
if test -f 'rcstell.1'
then
	echo shar: will not over-write existing file "'rcstell.1'"
else
sed 's/^X//' << \SHAR_EOF > 'rcstell.1'
X.\" Copyright (C) 1988 Diomidis Spinellis.  All rights reserved.
X.\" Permission to copy for any purpose is hereby granted so long
X.\" as this copyright notice remains intact.
X.\"
X.TH RCSTELL 1 "Nov 11, 1988"
X.UC 4
X.SH NAME
Xrcstell \- tell which RCS files are checked out as locked
X.SH SYNOPSIS
X.B rcstell
X[
X.B \-l
X] 
X.br
X.SH DESCRIPTION
X.I Rcstell
Xprints a list of any files that are checked out as locked in the 
Xcurrent directory.  It does so by examining all the files ending in
X.I ,v
Xin the current and the
X.I './RCS'
Xdirectories.
X.PP
XThe
X.B \-l
Xoption displays a longer output that consists of the file name, the
Xrevision name, the locker login name and the locker real name for
Xeach locked file.
X.PP
X.SH FILES
X.I *,v RCS/*,v
XThe files examined.
X.SH AUTHOR
XDiomidis Spinellis (dds@cc.ic.ac.uk)
X.SH "SEE ALSO"
Xrcs(1), co (1), ci (1), rlog (1).
X.sp 0
XWalter F. Tichy, "Design, Implementation, and Evaluation of a Revision Control
XSystem," in \fIProceedings of the 6th International Conference on Software
XEngineering\fR, IEEE, Tokyo, Sept. 1982.
X.SH BUGS
XDepends a lot on the format of the
X.I rlog
Xoutput as well as the the 
X.I passwd 
Xfile.  In particular it uses the ``,'' to distinguish the real name from the
X.I GCOS
Xfield.
SHAR_EOF
if test 1231 -ne "`wc -c < 'rcstell.1'`"
then
	echo shar: error transmitting "'rcstell.1'" '(should have been 1231 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'slist'" '(802 characters)'
if test -f 'slist'
then
	echo shar: will not over-write existing file "'slist'"
else
sed 's/^X//' << \SHAR_EOF > 'slist'
X#!/bin/sh
X#
X# Create a list of files and their revisions.
X#
X# (C) Copyright 1989 Diomidis Spinellis.  All rights reserved.
X# Permission to copy for any purpose is hereby granted so long
X# as this copyright notice remains intact.
X#
Xcase $# in
X0)
X	echo 1>&2 "Usage `basename $0` [-h] file ..." ; exit 1
X	;;
X1)
X	case $1 in
X	-*)
X		echo 1>&2 "Usage `basename $0` [-h] file ..." ; exit 1
X		;;
X	*)
X		ident $* |
X		awk '/\$Header/ {print substr($2, 1, length($2)-2), $3}' |
X		sort -u
X		;;
X	esac
X	;;
X*)
X	case $1 in
X	-h)
X		rlog -h $* |
X		awk '/^RCS file/ {printf "%s ", substr($3, 5, length($3)-7)} /^head:/ { print $2}' |
X		sort -u
X		;;
X	-*)
X		echo 1>&2 "Usage `basename $0` [-h] file ..." ; exit 1
X		;;
X	*)
X		ident $* |
X		awk '/\$Header/ {print substr($2, 1, length($2)-2), $3}' |
X		sort -u
X		;;
X	esac
X	;;
Xesac
SHAR_EOF
if test 802 -ne "`wc -c < 'slist'`"
then
	echo shar: error transmitting "'slist'" '(should have been 802 characters)'
fi
chmod +x 'slist'
fi # end of overwriting check
echo shar: extracting "'slist.1'" '(1778 characters)'
if test -f 'slist.1'
then
	echo shar: will not over-write existing file "'slist.1'"
else
sed 's/^X//' << \SHAR_EOF > 'slist.1'
X.\" Copyright (C) 1989 Diomidis Spinellis.  All rights reserved.
X.\" Permission to copy for any purpose is hereby granted so long
X.\" as this copyright notice remains intact.
X.\"
X.TH SLIST 1 "Aug 7, 1989"
X.UC 4
X.SH NAME
Xslist \- display the names and revision numbers of RCS files
X.SH SYNOPSIS
X.B slist
X[
X.B \-h
X] file ...
X.br
X.SH DESCRIPTION
X.I Slist
Xprints the names and revision numbers of the files given as arguments.
X.PP
XThe
X.B \-h
Xoption prints the revision number of the latest file in the trunk,
Xthus an slist of the 
X.I head 
X(frontier) of the RCS tree is printed.  This is useful for comparing against
Xthe output of
X.I slist
Xfrom an executable to check that the latest revisions were indeed used.
X.PP
XIf the
X.B \-h
Xoption is not used then the file name arguments need be
Xworking or executable
Xfile names containing valid 
X.I Header
Xidentifiers.
X.SH EXAMPLES
XCreate an slist from an executable:
X.RS
X.nf
X.ft B
X% slist executable >executable.slist
X.ft R
X.RE
X.br
X.ne 4
XCompare the working files against the latest revisions:
X.RS
X.nf
X.ft B
X% slist -h RCS/*.c,v >latest.slist
X% slist *.c | diff - latest.slist
X.ft R
X.fi
X.RE
X.SH DIAGNOSTICS
XComplaints from ident for files not containing identifiers.
X.br
XComplaints from rlog about non-existing RCS files.
X.SH AUTHOR
XDiomidis Spinellis (dds@cc.ic.ac.uk)
X.SH "SEE ALSO"
Xrcs(1), co (1), ci (1), rlog (1), ident(1).
X.sp 0
XWalter F. Tichy, "Design, Implementation, and Evaluation of a Revision Control
XSystem," in \fIProceedings of the 6th International Conference on Software
XEngineering\fR, IEEE, Tokyo, Sept. 1982.
X.SH BUGS
XDepends a lot on the format of the
X.I rlog
Xand
X.I ident
Xoutput.
X.PP
XIf a file contains no header keyword, but contains other keywords no
Xentry will be generated for that file, unless 
X.B \-h 
Xis used.
SHAR_EOF
if test 1778 -ne "`wc -c < 'slist.1'`"
then
	echo shar: error transmitting "'slist.1'" '(should have been 1778 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
Diomidis Spinellis          European Computer-Industry Research Centre (ECRC)
Arabellastrasse 17, D-8000 Muenchen 81, West Germany        +49 (89) 92699199
USA: diomidis%ecrcvax.uucp@pyramid.pyramid.com   ...!pyramid!ecrcvax!diomidis
Europe: diomidis@ecrcvax.uucp                      ...!unido!ecrcvax!diomidis


-- 
Scot E. Wilcoxon  sewilco@DataPg.MN.ORG    {amdahl|hpda}!bungia!datapg!sewilco
Data Progress 	 UNIX masts & rigging  +1 612-825-2607    uunet!datapg!sewilco
	I'm just reversing entropy while waiting for the Big Crunch.




Newsgroup alt.sources contents
Newsgroup list
Diomidis Spinellis home page

Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.