March 19, 2009

HOWTO: Automatically get svn revisions number under windows

"The example below shows how keywords in a template file are substituted in the output file.

// Test file for SubWCRev: testfile.tmpl

char *Revision = "$WCREV$";
char *Modified = "$WCMODS?Modified:Not modified$";
char *Date = "$WCDATE$";
char *Range = "$WCRANGE$";
char *Mixed = "$WCMIXED?Mixed revision WC:Not mixed$";
char *URL = "$WCURL$";

#if $WCMODS?1:0$
#error Source is modified
#endif

// End of file

After running SubWCRev.exe path\to\workingcopy testfile.tmpl testfile.txt, the output file testfile.txt would looks like this:

// Test file for SubWCRev: testfile.txt

char *Revision = "3701";
char *Modified = "Modified";
char *Date = "2005/06/15 11:15:12";
char *Range = "3699:3701";
char *Mixed = "Mixed revision WC";
char *URL = "http://tortoisesvn.tigris.org/svn/tortoisesvn/...
trunk/src/SubWCRev";

#if 1
#error Source is modified
#endif

// End of file
" tortoisesvn.net

No comments:

Post a Comment