SVN Keywords help me a lot in keeping my documents in order. Thanks to keywords I always know which version of the file I am looking at, when it was last modified and by whom. For text files, keywords are very simple to use. For binary file formats like the stuff you get with windows programms this does unfortunately not work. Binary keyword substitution may provide a way out of this problem, but only for the most simple of binary file formats. TortoiseSVN (> version 1.5) provides a way out of this problem. It can be acessed as a com component from within any windows application that provides the necessary interface.
Is you are using SVN from windows, you will most likely have TortoiseSVN installed. Starting with version 1.5 (or a current svn snapshot, as long as 1.5 is not released) provides an COM interface to read SVN keyword properties from within any language capable of accessing COM components. In Visual Basic for Applications this would look something like this:
Dim oSvn As Object Set oSvn = CreateObject("SubWCRev.object.1") oSvn.GetWCInfo ActiveDocument.FullName, 1, 1 Debug.Print "Revision: " & oSvn.Revision
ActiveDocument.FullName function returns the name of the curent
document in MS Word.
I wrote a VBA Word macro that stores the SVN keyword information into the Word document properties whenever the document is loaded, or a new document is created based on a template containing the macro.
The special property 'svnWarning' will show information about the curent state of affairs. It will contain a warning when Tortoise is not installed or when the document is not under SVN controll.
[Extras] -> [Macros] -> [Visual Basic Editor] [Import]
[Insert] -> [Field] -> [DocProperties]
An earlier Version of the script exists, that works with SVN fixed-length keywords. Note that this will only work with classic DOC file it will break with Office 2007 XML files.