#!/bin/sh
#	This file is part of the Concurrent Versions System CVS.
#	Written by Dick Grune, Vrije Universiteit, Amsterdam.
#	$Header: historian,v 3.1 89/09/25 16:36:25 dick Exp $

#
#	Historian: ad-hoc configuration history reconstruction program
#
#		historian [ repository ]
#	attempts to reconstruct the configuration history file of the
#	repository, using reasonable(?) heuristics.  If no repository is given,
#	the repository of the present directory is used.
#
#	This simple script assumes that there are no "removed files", i.e.,
#	that the Attic is non-existent or empty.
#
Name=historian; export Name

# CVSBIN, CVSLIB and RCSBIN directories
CVSBIN=/home/top/dick/cvs
CVSLIB=/home/top/dick/cvs
RCSBIN=${RCSBIN-/usr/local/bin}
export CVSBIN CVSLIB RCSBIN

# avoid spurious identifications
PATH=${CVSPATH-/bin:/usr/bin}; export PATH

# determine the name of the repository
Repository=$1
. $CVSLIB/NR.aux

# worry about the Attic
if	# there is an Attic
	[ -d $Repository/Attic ]
then	# it may still be empty
	REMOVED=`ls $Repository/Attic`
fi

if	# some files have been removed
	[ -n "$REMOVED" ]
then	# tell the truth
	echo "The configuration history file reconstructed for $Repository"
	echo "will not be completely correct, although it is still a good"
	echo "approximation. Obtaining a correct configuration history file"
	echo "requires manual assistance concerning the removal dates of"
	echo "$REMOVED" |
	sed 's/,v//'
	echo "See the manual page of 'historian' for further information."
	echo ""
fi

$CVSBIN/hist1 $Repository |
$CVSBIN/hist2 $Repository |
sh

