Hi Chris,
You can run the
svn info command and parse its output. Here's how:
function SVNInfo()
{
var strFileName = Project.FileName;
var strSVNPath = "C:\\Program Files\\TortoiseSVN\\bin\\svn.exe";
// Run "svn info" and wait for completion
var strCommand = aqString.Quote(strSVNPath) + " info " + aqString.Quote(strFileName);
var oExec = Sys.OleObject("WScript.Shell").Exec(strCommand);
while (oExec.Status == 0)
{
Delay(100);
}
if (oExec.ExitCode == 0)
{
// Get "svn info" output
var strInfo = oExec.StdOut.ReadAll();
// Extract Revision and Last Changed Rev from the output
var reRev = /^Revision: (\d+)$/im;
var reLastRev = /^Last Changed Rev: (\d+)$/im;
var strRev = strInfo.match(reRev)[1];
var strLastRev = strInfo.match(reLastRev)[1];
Log.Message("Revision: " + strRev);
Log.Message("Last Changed Rev: " + strLastRev);
}
else
{
Log.Error("svn info error; see Additional Info", oExec.StdErr.ReadAll());
}
}