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

Re: svn keyword expansion

From: Ryan Schmidt <subversion-2007b_at_ryandesign.com>
Date: Fri, 4 Jan 2008 00:12:23 -0600

On Jan 3, 2008, at 22:49, Srilakshmanan, Lakshman wrote:

> In the first email :
>
>>> then the Subversion client will
>>> transform '$Id:foo$' to '$Id$' before sending the file to the
>>> server,

After some testing, I realize I was inaccurate here. When I said
"$Id:foo$" I should have said "$Id: foo $".

>>> thus likely corrupting it if it is a binary file. The data has been
>>> changed before the file was sent to the repository, therefore there
>>> is no way to retrieve the original from the repository.
>
> May be its my misunderstanding, but from the text above, I understood
> the file is updated and the updated version is sent to the repository.
> That would indicate that the server would store the keyword expanded ?

Sorry, I was unclear. The repository stores the keywords unexpanded.
The client normalizes the keywords to the unexpanded form before
sending the file to the repository to be stored.

> But in the next email you indicate :
>
>>> Therefore, it sees the file as it exists in the repository -- with
>>> keywords unexpanded. As
>>> you know, only a Subversion client performs the keyword
>>> expansion.
>
> So the question is
> A) does the server store the keyword *expanded*
> B) does the server store the keywords *unexpanded*

It is B.

> If the answer is B) then the file should not be corrupted, as the
> keywords have not been expanded. That is, the expansion is performed
> when the client checks out the file.

Well... If the file you originally committed had the keywords
unexpanded (e.g. "$Id$") then that's true: the file stored in the
repository matches the file you had in your working copy before
committing, and so the file in the repository is fine. After the
commit, the client expands the keywords in the file in the working
copy, so it becomes corrupted, possibly. If you use svn checkout or
svn update or svn cat or svn export to retrieve the file from the
repository, the keywords will be expanded, and the retrieved file
will be corrupted, possibly.

However, if the file you originally committed had the keywords
expanded (e.g. "$Id: something $") then the file in the repository
will (possibly) be corrupted because "$Id: something $" will be
converted by the client to "$Id$" before being stored in the repository.

The only way I know of to retrieve the file with unexpanded keywords
as it exists in the repository is to host the repository with Apache
2 and view the file in a web browser.

> If the answer is A) then a browser should see the expanded keywords ?

When viewed through a web browser, you see the file as it exists in
the repository, with unexpanded keywords.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-01-04 08:16:08 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.