info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cvs remove and pre-commit check


From: Lakshman Srilakshmanan
Subject: cvs remove and pre-commit check
Date: Wed, 16 Nov 2005 15:32:50 +1100

Hi All,

I have checked the mail archives and researched on google with no luck.
This is my last ditch effort to try and resolve this problem. Your help
will be much appreciated.

I have a pre-commit check as follows. It checks to ensure that the cvs
tags Author, Revision and Header are present in the file.

#!/bin/sh

filename=$*

dirName=$2
date >> /tmp/commit.log
id -un >> /tmp/commit.log
echo $filename >> /tmp/commit.log
echo $dirName >> /tmp/commit.log


Author=`grep '\$Author' $filename`
Revision=`grep '\$Revision' $filename`
Header=`grep '\$Header' $filename`
if [ -z "$Author" ] ; then
    echo "Author does not Exists"
    exit 1
fi
if [ -z "$Revision" ] ; then
    echo "Revision does not Exists"
    exit 1
fi
if [ -z "$Header" ] ; then
    echo "Header does not Exists"
    exit 1
fi




It works fine for new files and changes. But when I commit after a "cvs
remove" I get the following error

grep: sgs13.txt: No such file or directory


I understand, that since the file does not exist, grep can't find it. 
But $* contains the following.

/cvs/sgs/src/conf sgs13.txt               Note : /cvs ==> is my "cvs
server root".


Therefore non of my greps should have worked as the file will be called
sgs13.txt,v under /cvs and 
would not exist under the repository anyway (for new files).


Q1. how does cvs know about my file when I am working from windows
client and the cvs server in on Linux.
Q2. Why does it work for new files when the directory is /cvs. New files
will not exist in the repository
Q3. Any workaround ?

Could someone please, please help me.

Thanks
Lakshman





reply via email to

[Prev in Thread] Current Thread [Next in Thread]