info-cvs
[Top][All Lists]
Advanced

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

Re: cvs update $Name: $ expansion


From: Stuart Cooper
Subject: Re: cvs update $Name: $ expansion
Date: Thu, 23 Jun 2005 13:19:57 +1000

> I can't get $Name: $ to expand on an update in my script below.

> It works when checking out. But, do I really have to do a checkout?

> Because a clean checkout every night would be expensive over a crappy
> connection.

> debian$ cat test.sh
> DATE=`date +%s`
> TAG=test_$DATE
> MODULE='t'

> echo Tagging module: $MODULE with tag: $TAG

> # Snapshot the module in the repo
> cvs rtag $TAG $MODULE

> # Updating to that snapshot
> cvs update -r $TAG

> tag="$Name:  $"
> echo $tag |sed 's/^.*: //;s/ .*$//'

You're very mixed up here. The whole point of $Name: $ is you put them in
your source files and they get automagically transformed for you on checkin and
checkout. You don't use them as tag names and you shouldn't be doing sed
magic by yourself.

Common idiom (in say a Perl project)
#!/usr/bin/perl
# $Id$
use DBI;
...etc etc rest of script goes here

After the next checkin/checkout you get some nice info on the state of the file
#!/usr/bin/perl
# $Id: newDSLTests.pl,v 1.19 2005/04/15 04:00:58 scooper Exp $
use DBI;

There's a trick in C programming, something like
static char RCSId[]="$Id$";
and it gets compiled into the executable so it can later be found as
a string in the executable so you know what versions made up your compiled
software.

Take a few steps back and think about what $Id$, $Name$ are all about.

Have fun,
Stuart.




reply via email to

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