[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: AW: Problem with binary files which containing the revision number.

From: Ryan Schmidt <subversion-2010d_at_ryandesign.com>
Date: Wed, 8 Dec 2010 13:26:08 -0600

On Dec 8, 2010, at 08:37, Merkle Andreas wrote:

> Ryan Schmidt wrote:
>
>> If the text you type into the document will appear in the binary file in plain text (as it seems to in Word files for example), then you can use Subversion keywords as you would in any text file. Subversion has fixed-width versions of its keywords that you would use in this case, to ensure that expanding the keyword won't corrupt the file. So just type "$Rev:: $" or "$Id:: $" in your document, and set svn:keywords on that document to that key. Make sure you use double colons after the keyword name so that you get the fixed-width versions, otherwise you will corrupt the file.
>>
>> See:
>>
>> http://svnbook.red-bean.com/nightly/en/svn.advanced.props.special.keywords.html
>
> That's a workaround for the binary files, which contains the keywords as plain text. Ok.

I'd say what you're proposing, trying to divine the revision before it's committed, is a workaround, or more, a hack. There's no 100% accurate way to guarantee what revision you'll get, before you've gotten it.

Using the $Id$ or $Rev$ keywords isn't a workaround, it's the correct solution; this is a supported feature of Subversion.

> But it is not really safe ... there is still a probability that the binary will be corrupt afterwards.

Well, only if you think the string "$Id::" (or "$Rev::") is likely to appear in the binary representation of the file elsewhere than where you typed it. It depends on the specific binary format of course, so you can only know by trying it out. I would feel OK using this in Word documents, since the book suggests keywords can be used in Word documents, and others on the list have over the years reported this working in Word documents, and I haven't heard of any corruption reported.

> And it doesn't work for all the other binary files, e.g. schematics, etc.

Ah, that's too bad. I guess whatever format the schematic files are in doesn't store the text you type in the document in plain text in the binary representation. Then I don't have a solution for those types of files.
Received on 2010-12-08 20:26:49 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.