Luciano Resende wrote:
My understanding is that expanded keywords are not considered in svn
diff, commit, etc, and it's more like a local visual piece of
information.
From [1], here is a little info on the subject.
"Keywords and Spurious Differences
The user-visible result of keyword substitution might lead you to
think that every version of a file with that feature in use differs
from the previous version in at least the area where the keyword
anchor was placed. However, this is actually not the case. While
checking for local modifications during svn diff, and before
transmitting those local modifications during svn commit, Subversion
"un-substitutes" any keywords that it previously substituted. The
result is that the versions of the file that are stored in the
repository contain only the real modifications that users make to the
file."
[1] http://svnbook.red-bean.com/en/1.1/ch07s02.html
Thanks for providing the missing piece of the puzzle to explain
my recent experience. svn does this when producing a patch, but
the "patch" tool is not aware of these keywords and cannot adjust
for them when I apply the patch to a different level of code.
Here's the problem that I ran into.
1. Check out a file at version x. The keywords are expanded
to indicate version x.
2. Make a change near the version line.
3. Produce a patch using svn diff. The version keywords are
automatically unsubstituted by svn in the patch lines that
provide surrounding positional context for the change.
4. Check out the file again at version y. It doesn't matter
whether y > x or y == x.
5. Use "patch" to apply the patch produced in step 3 to the
file checked out in step 4. This will fail because the
surrounding context lines in the patch have unexpanded
keywords, but the same lines in the file that was checked
out in step 4 have the keywords expanded.
I think there are two possible solutions to this. Either I
can recover from the failure when it occurs by manually
expanding or unexpanding keywords in the patch or base file
to force the surrounding context lines to match, or I can
avoid the issue by setting my svn config to disable keyword
expansion when I do checkouts. I'd be more inclined to do
the second than the first, but this calls into question the
value of having these keywords in our source files.
Simon
On Wed, Apr 23, 2008 at 5:45 AM, Simon Nash <[EMAIL PROTECTED]> wrote:
Mark Combellack wrote:
Hi Simon,
Have you recently changed your Subversion configuration file to enable SVN
keyword expansion? The file in question is located:
Windows %USERPROFILE%\Application Data\Subversion\config
Linux ~/.subversion/config
The value in question is enable-auto-props. If this is set to yes then it
will expand keywords. By default this value is set to no.
There were discussions on the dev list about this around the end of March
beginning of April. See:
http://www.mail-archive.com/[email protected]/msg29637.html
http://www.mail-archive.com/[email protected]/msg29781.html
These discussions suggested changing the SVN config to enable keyword
expansion.
Perhaps this is the cause of the problem?
Mark
Thanks for the explanation. If I understand this correctly, this
configuration setting will cause these keywords to expand differently
every time an update is made to the file. This will cause problems
when applying a patch derived from an earlier checked out version
of the file to a later checked out version, if the patch happens to
include this line and if any updates have been made elsewhere in
the file between the two checkouts.
This won't occur very often, but it did happen to me today, and it
is a nuisance having to work around it by reverse engineering the
patch.
Simon
-----Original Message-----
From: Simon Nash [mailto:[EMAIL PROTECTED]
Sent: 23 April 2008 10:16
To: tuscany-dev
Subject: SVN version keyword expansion
On April 1, I checked out a file from SVN. Its version keywords
were not expanded in my local copy. Yesterday I checked out the
same file and the version keywords were expanded. This caused my
attempt to apply a patch (derived from the previous checkout)
to fail.
The file when viewed in SVN contains the header line
* @version $Rev$ $Date$
My previous local checkout had the identical line. My current
local checkout has the line
* @version $Rev: 643696 $ $Date: 2008-04-02 04:24:11 +0100 (Wed, 02 Apr
2008) $
What is causing this line to now get expanded in my local checked out
copy, and why wasn't it expanded when I checked it out previously?
Simon