RE: How to detect if a file is new

"Crisp, Norman (Norman)" <[email protected]> Thu, 22 Nov 2012 20:08:59 +0000
Newsgroups gmane.comp.version-control.cvs.general
Message-ID <755AF814786B004F9837F99BA903C0A41383F889@US70TWXCHMBA07.zam.alcatel-lucent.com>
Please ignore my previous post.

I found I can achieve this by looking for the 3rd field being a "0" instead of looking for the 4th field being the "dummy timestamp"

Norm. 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Crisp, Norman (Norman)
Sent: Thursday, November 22, 2012 1:50 PM
To: [email protected]
Subject: How to detect if a file is new

I was wondering if anyone knows if there is a way upon commit to detect if the file being committed is a new file.
I wish to implement a process by way of a script run through commitinfo that will block a file from being committed only if it is new, and being added into a certain part of the repository tree.

I can see that once a file has been created, and then cvs add applied, the entry for the new file gets put in the CVS/Entries file as something like this:  /test-file.txt/0/dummy timestamp/-ko/

Locally I can detect it is new by looking for "dummy timestamp"

# CommitFile=test-file.txt
# CommitType=`grep "^/${CommitFile}/" CVS/Entries | cut -d/ -f4` # echo $CommitType # dummy timestamp

But when this actually runs on the server something magical must happen as my return is always blank.

Thank you

Norm.