1

I'd like to capture the svn revision of my code automatically when I build an installer using NSIS. I see I can get the revision number by calling "svnversion" at the command line, but how can I map that to a ${define} in my NSIS script at build time?

Anders
  • 97,548
  • 12
  • 110
  • 164
danger
  • 123
  • 1
  • 11

2 Answers2

2

You can execute any command at compile time with !system and then get/parse the output with !searchparse, !define /file or !include.

Another alternative is the $Revision$ svn keyword (See this question for more)

Community
  • 1
  • 1
Anders
  • 97,548
  • 12
  • 110
  • 164
  • 1
    Thanks Anders, I got it working with this: `!tempfile "svnrev.txt" !appendfile "svnrev.txt" "!define SVN_REV " !system "svnversion ..\ >> svnrev.txt" !include "svnrev.txt" !delfile "svnrev.txt" DetailPrint ${SVN_REV}` – danger Feb 21 '12 at 00:46
0

If you use Windows (you use it, isn't it?), you can use SubWCRev from TortoiseSVN.

I.e:

  • you have template of NSIS script, in which repository-related data is replaced by SubWCRev-keywords
  • Your build-system use SubWCRev at some stage in order to get actual script, with up-to-date data from repo

Example (extraction from my template in project)

// (C) 2009-$WCDATE=%Y$
// Assembled from $WCDATE=%Y%m%d$-r$WCREV$

will appear in final file after SubWCRev magic as (for last build)

// (C) 2009-2012
// Assembled from 20120122-r1143

New revision - new data, updated header

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110