Re: SVN version keyword expansion
On Thu, Apr 24, 2008 at 1:32 PM, Simon Nash <[EMAIL PROTECTED]> wrote: > 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 use TortoiseSVN to apply patches and I don't recall running into this kind of problem. May be it is a problem with the patch command?? > > > 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/tuscany-dev@ws.apache.org/msg29637.html > > > > > > > > http://www.mail-archive.com/tuscany-dev@ws.apache.org/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 pre
Re: SVN version keyword expansion
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/tuscany-dev@ws.apache.org/msg29637.html http://www.mail-archive.com/tuscany-dev@ws.apache.org/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
Re: SVN version keyword expansion
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 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/tuscany-dev@ws.apache.org/msg29637.html > >http://www.mail-archive.com/tuscany-dev@ws.apache.org/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 > > > > > > > > > > > > > > > > -- Luciano Resende Apache Tuscany Committer http://people.apache.org/~lresende http://lresende.blogspot.com/
Re: SVN version keyword expansion
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/tuscany-dev@ws.apache.org/msg29637.html http://www.mail-archive.com/tuscany-dev@ws.apache.org/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
RE: SVN version keyword expansion
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/tuscany-dev@ws.apache.org/msg29637.html http://www.mail-archive.com/tuscany-dev@ws.apache.org/msg29781.html These discussions suggested changing the SVN config to enable keyword expansion. Perhaps this is the cause of the problem? Mark > -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 >
Re: SVN version keyword expansion
On Wed, Apr 23, 2008 at 10:16 AM, Simon Nash <[EMAIL PROTECTED]> wrote: > 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 > > > Did the svn properties on the file change? I was under the impression that the svn:keywords property had to be set for this to work. Simon
Re: SVN version keyword expansion
SVN stores the keywords along with the file and does not store the expanded keywords internally. So, when the file is viewed in svn, it will show "@version $Rev$ $Date$". It is the svn client that expands these keywords when the file is checked out. These keywords have been added to svn after your last checkout time. For this reason the keywords have not been expanded at your previous checkout. What is the svn url for the file in question? ++Vamsi On Wed, Apr 23, 2008 at 2:46 PM, Simon Nash <[EMAIL PROTECTED]> wrote: > 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 > > >