Search code examples
cvs

Escape $id$-string in file


I´m writing some code-generator. Every source-code-file generated by this should start with the special cvs-command $id$ which gets replaced by CVS on checkin.

So I have this code:

code.Comments.Add(new CodeCommentStatement("$Id$"));

Where code is of type System.CodeDom.CodeNamespace.

However the codegenerator itself is hosted on our version-control-system and thus the "$id"-part within my generators source-code gets replaced on checkin as well.

How can I escape the sequence so that the string does not get replaced?


Solution

  • Just split it up or create a variable. Something like this. (Forgive my possibly incorrect java syntax.)

    code.Comments.Add(new CodeCommentStatement("$I" + "d$"));
    

    or

    var dollar='$';
    code.Comments.Add(new CodeCommentStatement(dollar+"Id"+dollar));
    

    While you could also make that script file binary in cvs (-kb), I don't think that's advisable.