[cvsnt] keyword dollar sign collision with variable

Kerry, Richard richard.kerry at siemens.com
Wed Oct 3 09:55:34 BST 2007


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


I've recently been working on something which sounds a bit like this.
I've been using xsl, which is another language that uses '$' to mark the
beginning of variables.
I wanted to get the xsl script to have some CVSNT keywords in it which
would be transferred into the resultant file with the dollars removed,
which made the issue a bit more complex than it might have been.
What I've done is to put the keywords into strings, like this 

<xsl:variable name="id">$Id$</xsl:variable>

(
C++ equivalent would be something like
string sId = "$Id";
)

By the time the script has been used (compiled in the C case) it's been
committed to cvs and the id keyword has been expanded.

Then use a substring function to remove the dollars before writing it to
the output file.

<xsl:variable name="id_base"
select="substring($id,2,string-length($id)-4)"/>

(
C++ equivalent would be something like
string sIdBase;
sIdBase = substring( szId, 2, sId.length() -4 );
)

Then there's a line of code which writes id_base to the output file.
This allows me to get written into the output file the version of the
xsl script (or C++ program) that was used to create it, as well as
allowing the output file to have its own $Id$ entries to show its own
version.

So, my suggestion to Boris would be to consider putting the tags into
strings, if his language has no usable comment syntax.


Regards,
Richard.


PS 
In the longer term might it be possible to change CVSNT to allow a
different character to be used to mark keywords ?




  

> -----Original Message-----
> From: cvsnt-bounces at cvsnt.org 
> [mailto:cvsnt-bounces at cvsnt.org] On Behalf Of Tony Hoyle
> Sent: 03 October 2007 00:36
> To: cvsnt at cvsnt.org cvsnt downloads at march-hare.com @CVSNT on Twitter CVSNT on Facebook
> Subject: Re: [cvsnt] keyword dollar sign collision with variable
> 
> Boris Smirnov wrote:
> 
> > For my programming language it does not matter if it's in 
> comment or 
> > not, it's only looking for the $ signs. :)
> > It's a macro language for a special programm that we use. 
> So comment 
> > will not help, I already tried. I'm wondering if there 
> could be another 
> > workaround.
> 
> Hmm... odd language though that doesn't support comments.  You might 
> have to switch keywords off for those files (assuming you 
> can't change 
> the behaviour of the language).
> 
> >  > btw. I'd avoid $Log as it creates merging problems.
> > And what it then other way of writting the commit message 
> (comment ) to 
> > the file?
> >
> Normally you wouldn't - you rely on audit for that.  The problem with 
> log is it changes the length of the file, so you get changes 
> that aren't 
> part of the code and can't be reversed by the merge code... causes 
> conflicts that you wouldn't normally get.
> 
> It still works OK but creates work when you're checking for 
> differences etc.
> 
> Tony
> _______________________________________________
> cvsnt mailing list
> cvsnt at cvsnt.org cvsnt downloads at march-hare.com @CVSNT on Twitter CVSNT on Facebook
> http://www.cvsnt.org/cgi-bin/mailman/listinfo/cvsnt https://www.march-hare.com/cvspro/en.asp#downcvs
> 


More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook