Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's an easy way to obtain the current svn revision in a c++ visual studio application

Tags:

c++

svn

Is there any easy way to access the SVN repository revision number and store it in a c++ string in a c++ visual studio application?

Thanks for your help in advance!

like image 959
BeachRunnerFred Avatar asked Oct 25 '08 16:10

BeachRunnerFred


People also ask

How do I revise in svn?

"svn info --show-item revision" will give the current revision to which the current directory is updated.

What is svn revision?

Subversion, with the command line tool svn, is a revision control system, also known as a source code management system (scm) or a source code control system (sccs). The subversion server maintains a repository, where files are stored in a hierarchy of folders, same as a traditional file system.


1 Answers

If you have tortoise SVN you can use SubWCRev.exe

Create a file called:

RevisionInfo.tmpl

int SvnRevision = $WCREV$;

Then execute this command:

SubWCRev.exe . RevisionInfo.tmpl RevisionInfo.cpp

It will create a file ReivisonInfo.cpp with your revision number as follows:

int SvnRevision = 5000;

From your other files just do something like:

extern int SvnRevision; to access the global variable from within that file.

You could also use SvnRev

like image 84
Brian R. Bondy Avatar answered Sep 29 '22 16:09

Brian R. Bondy