You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Dain Sundstrom <ds...@gluecode.com> on 2004/09/11 08:55:43 UTC

Subversion keyword expansion not working

> -<!-- $Revision: 1.34 $ $Date: 2004/09/02 18:32:25 $ -->
> +<!-- $Revision: 1.34 $ $Date$ -->

Look like Subversion doesn't like our keywords.  After checking the 
Subversion book, I think our tag should be:

$Rev$ $Date$

but Subversion doesn't seem to be handling even our existing $Date$ tag.

Anyone know what is going on?

-dain


Re: Subversion keyword expansion not working

Posted by Jacek Laskowski <jl...@apache.org>.
David Blevins wrote:

> Why not throw this into the find
> 
>   -exec sed -i.bak 's,\$Revision: [^$]* \$,\$Rev\$,' {} \;
> 
> ...and skip the loop and extra files?

Thanks Dave for the tip and the previous one about Confluence!

> -David

Jacek


Re: Subversion keyword expansion not working

Posted by David Blevins <da...@visi.com>.
On Sun, Sep 12, 2004 at 01:03:37AM +0200, Jacek Laskowski wrote:
> 
> Here's the script to run. It replaces $Revision: ...$ to $Rev$.
> 
> #!/bin/sh
> 
> find etc -path "*/.svn" -prune -o -type f -print | while read file;
> do
>         sed 's,\$Revision: [^$]* \$,\$Rev\$,' $file > $file.changed
>         mv $file.changed $file
>         rm $file.changed
> done
> 
> Having done this, I'll be 'svn propset svn:keywords "author date id rev" 
>  $file' and commit the files ('svn ci --message "Changing $Revision$ to 
> $Rev$" $files).
> 
> Is the order ok? May I change the keyword, commit the change and propset 
> afterwards or is the commit not necessary?
> 
> Any comments?
> 

Why not throw this into the find

  -exec sed -i.bak 's,\$Revision: [^$]* \$,\$Rev\$,' {} \;

...and skip the loop and extra files?

-David

Re: Subversion keyword expansion not working

Posted by Jacek Laskowski <jl...@apache.org>.
Dain Sundstrom wrote:

> I'm sorry. Bad link... here is the correct one:
> 
> http://svn.apache.org/viewcvs.cgi/geronimo/trunk/etc/maven.xml? 
> rev=45918&root=Apache-SVN&view=markup

Aha, I see. What's on the server differs from what's checked out. That's 
nice and as you already pointed out very useful when merging branches.

> There are two steps:
> 
> 1) change all places in our code where we have $Revsiosn$ to $Rev$
> 2) add the rev keyword to the list of keywords to expanded by  
> subversion (must be done on a file by file basis)

Here's the script to run. It replaces $Revision: ...$ to $Rev$.

#!/bin/sh

find etc -path "*/.svn" -prune -o -type f -print | while read file;
do
         sed 's,\$Revision: [^$]* \$,\$Rev\$,' $file > $file.changed
         mv $file.changed $file
         rm $file.changed
done

Having done this, I'll be 'svn propset svn:keywords "author date id rev" 
  $file' and commit the files ('svn ci --message "Changing $Revision$ to 
$Rev$" $files).

Is the order ok? May I change the keyword, commit the change and propset 
afterwards or is the commit not necessary?

Any comments?

> -dain

Jacek


Re: Subversion keyword expansion not working

Posted by Jacek Laskowski <jl...@apache.org>.
Jacek Laskowski wrote:

> Dain Sundstrom wrote:
> 
>> There are two steps:
>>
>> 1) change all places in our code where we have $Revsiosn$ to $Rev$
>> 2) add the rev keyword to the list of keywords to expanded by  
>> subversion (must be done on a file by file basis)

Over the past 2 days I finally managed to run the script.

  o All of the occurences of $Revision$ to $Rev$ replaced
  o 'svn propset rev' invoked on selected files
  o All of the occurences of $Id$ to $Rev$ $Date$ replaced
  o At least 3 files that caused the repo to not be able to revert 
(accidentally) corrected

Unless it's said that some files became unmanageable (whatever it'd 
mean) the task is finished.

Jacek


Re: Subversion keyword expansion not working

Posted by Jacek Laskowski <jl...@apache.org>.
Dain Sundstrom wrote:

> There are two steps:
> 
> 1) change all places in our code where we have $Revsiosn$ to $Rev$
> 2) add the rev keyword to the list of keywords to expanded by  
> subversion (must be done on a file by file basis)

Over the weekend I prepared a script to make it done. They're just being 
committed. However, the connection I'm using is sooooo slow that I'm not 
sure when it's done if at all. Just had to kill it again as it seemed to 
have hung :(

Dain, could you please run the script (attached below) and commit the 
changes?

Also there were times when I had to revert the changes using svn revert 
and some files didn't allow me to do it because the following message 
from svn:

svn: Inconsistent line-endings in source stream

The files are:

sandbox/xbeans/src/schema/application-client_1_4.xsd
modules/common/src/java/org/apache/geronimo/common/propertyeditor/IteratorEditor.java
specs/j2ee-jacc/xdocs/navigation.xml

Does anyone know what's wrong with them?

Here's the script I used:

#!/bin/sh

DIR=.

find $DIR -path "*.svn" -prune -o -type f | while read file;
do
         # Check if it's .svn directory (don't know how to eliminate it 
directly with find)
         if [ -d $file ]; then
                 echo $file is directory - skip it
                 continue;
         fi

         isbinary=false;
         if [ my`svn propget svn:mime-type $file` = 
my"application/octet-stream" ]; then
                 isbinary=true
         fi
         if $isbinary ;
         then
                 echo $file is binary - Do not touch it
                 echo $file >> binaries.txt
                 #svn revert $file
         else
                 echo $file is NOT binary
                 sed -i.bak 's,\$Revision: [^$]* \$,\$Rev\$,' $file
                 svn propset svn:keywords "author date id rev" $file
                 echo $file >> text.txt
         fi
done

find $DIR -name "*.bak" | xargs rm

> 
> -dain

Jacek



Re: Subversion keyword expansion not working

Posted by Dain Sundstrom <ds...@gluecode.com>.
On Sep 11, 2004, at 2:35 PM, Jacek Laskowski wrote:

> Dain Sundstrom wrote:
>
>> I think I got this one figured out.  It looks like Subversion is   
>> different from CVS in that it does not store files on the server with  
>>  keywords expanded (which was totally throwing me off).  In CVS we  
>> had  this stored on the server   
>> (http://cvs.apache.org/viewcvs.cgi/incubator-geronimo/etc/maven.xml?  
>> view=markup):
>> <!-- $Revision: 1.34 $ $Date: 2004/09/07 02:35:13 $ -->
>> and in subversion we get this   
>> (http://svn.apache.org/viewcvs.cgi/geronimo/trunk/etc/maven.xml?  
>> rev=45828&root=Apache-SVN&view=markup):
>> <!-- $Rev$ $Date$ -->
>
> I see the same as the one above, i.e.
>
> <!-- $Revision: 1.34 $ $Date: 2004/09/07 02:35:13 $ -->
>
> So, either we look at different files or I do not fully understand  
> your explanation :(

I'm sorry. Bad link... here is the correct one:

http://svn.apache.org/viewcvs.cgi/geronimo/trunk/etc/maven.xml? 
rev=45918&root=Apache-SVN&view=markup

>> svn propset svn:keywords "author date id rev" files
>> Well we only really need date and rev, but might as well have the   
>> others.
>
> That one was discussed before and we decided to have *only* rev and  
> date. I don't see any value in having them in the source code again.
>
>> Anyone with commit want to take a shot at make these changes?
>
> As said above, I don't understand what would have to be done, so can't  
> help :(

There are two steps:

1) change all places in our code where we have $Revsiosn$ to $Rev$
2) add the rev keyword to the list of keywords to expanded by  
subversion (must be done on a file by file basis)

-dain


Re: Subversion keyword expansion not working

Posted by Jacek Laskowski <jl...@apache.org>.
Dain Sundstrom wrote:

> I think I got this one figured out.  It looks like Subversion is  
> different from CVS in that it does not store files on the server with  
> keywords expanded (which was totally throwing me off).  In CVS we had  
> this stored on the server  
> (http://cvs.apache.org/viewcvs.cgi/incubator-geronimo/etc/maven.xml? 
> view=markup):
> 
> <!-- $Revision: 1.34 $ $Date: 2004/09/07 02:35:13 $ -->
> 
> and in subversion we get this  
> (http://svn.apache.org/viewcvs.cgi/geronimo/trunk/etc/maven.xml? 
> rev=45828&root=Apache-SVN&view=markup):
> 
> <!-- $Rev$ $Date$ -->

I see the same as the one above, i.e.

<!-- $Revision: 1.34 $ $Date: 2004/09/07 02:35:13 $ -->

So, either we look at different files or I do not fully understand your 
explanation :(

> svn propset svn:keywords "author date id rev" files
> 
> Well we only really need date and rev, but might as well have the  others.

That one was discussed before and we decided to have *only* rev and 
date. I don't see any value in having them in the source code again.

> Anyone with commit want to take a shot at make these changes?

As said above, I don't understand what would have to be done, so can't 
help :(

> -dain

Jacek


Re: Subversion keyword expansion not working

Posted by Jeremy Boynes <jb...@gluecode.com>.

Dain Sundstrom wrote:

> On Sep 11, 2004, at 6:36 PM, Jeremy Boynes wrote:
> 
>> Dain Sundstrom wrote:
>>
>>> svn propset svn:keywords "author date id rev" files
>>> Well we only really need date and rev, but might as well have the  
>>> others.
>>
> 
> I was not suggesting we add them back in.  The default keywords supportd 
> are "author date id", and I was merely suggesting we add ref to the list.
> 

Guess I misunderstood "might as well have the others"

If what we are doing is adding it to the keyword list but not to the 
files themselves then I'm OK with it.

--
Jeremy


Re: Subversion keyword expansion not working

Posted by Dain Sundstrom <ds...@gluecode.com>.
On Sep 11, 2004, at 6:36 PM, Jeremy Boynes wrote:

> Dain Sundstrom wrote:
>
>> svn propset svn:keywords "author date id rev" files
>> Well we only really need date and rev, but might as well have the  
>> others.
>
> We dropped author for reasons that I don't think have changed so I 
> would  -1 adding that back in.
>
> In CVS $Id$ is a shortcut for specifying others. I don't think we need 
> that as well as date and rev. Let's stick to just what we were using 
> before, date and rev.

Jeremy,

I was not suggesting we add them back in.  The default keywords 
supportd are "author date id", and I was merely suggesting we add ref 
to the list.

-dain


Re: Subversion keyword expansion not working

Posted by Jeremy Boynes <jb...@gluecode.com>.
Dain Sundstrom wrote:

> 
> svn propset svn:keywords "author date id rev" files
> 
> Well we only really need date and rev, but might as well have the  others.
> 

We dropped author for reasons that I don't think have changed so I would 
  -1 adding that back in.

In CVS $Id$ is a shortcut for specifying others. I don't think we need 
that as well as date and rev. Let's stick to just what we were using 
before, date and rev.

--
Jeremy


Re: Subversion keyword expansion not working

Posted by Dain Sundstrom <ds...@gluecode.com>.
I think I got this one figured out.  It looks like Subversion is  
different from CVS in that it does not store files on the server with  
keywords expanded (which was totally throwing me off).  In CVS we had  
this stored on the server  
(http://cvs.apache.org/viewcvs.cgi/incubator-geronimo/etc/maven.xml? 
view=markup):

<!-- $Revision: 1.34 $ $Date: 2004/09/07 02:35:13 $ -->

and in subversion we get this  
(http://svn.apache.org/viewcvs.cgi/geronimo/trunk/etc/maven.xml? 
rev=45828&root=Apache-SVN&view=markup):

<!-- $Rev$ $Date$ -->

I think this is pretty cool and should eliminate with the keyword  
conflicts that CVS had.  Assuming we want the same keywords we had  
before, we will need to modify all files to change \$Revision: .* \$ to  
$Rev$ (assuming I got the regex right).  Then we need to change all of  
our non-binary files to have these keywords.

svn propset svn:keywords "author date id rev" files

Well we only really need date and rev, but might as well have the  
others.

Anyone with commit want to take a shot at make these changes?

Also can one of you script ninjas write a script to check if we are  
using any other CVS keywords?

Thanks,

-dain

--
Dain Sundstrom
Chief Architect
Gluecode Software
310.536.8355, ext. 26

On Sep 11, 2004, at 7:37 AM, Aaron Mulder wrote:

> 	The cvs2svn documentation says 'By default, cvs2svn sets
> svn:keywords on CVS files to "author id date" if the mode of the RCS  
> file
> in question is either kv, kvl or not kb'.  I don't know whether it's  
> case
> sensitive, or that behavior was disabled, or what -- but apparently  
> there
> are properties on each file indicating whether keywords should be
> expanded...
>
> 	Okay, looking at the properties on the STATUS file, the
> svn:keywords is in fact set to "author date id"...  Perhaps we just  
> need
> to change the capitalization?  An example in the "propget"  
> documentation
> shows svn:keywords set to "Author Date Rev"...
>
> Aaron
>
> On Fri, 10 Sep 2004, Dain Sundstrom wrote:
>>> -<!-- $Revision: 1.34 $ $Date: 2004/09/02 18:32:25 $ -->
>>> +<!-- $Revision: 1.34 $ $Date$ -->
>>
>> Look like Subversion doesn't like our keywords.  After checking the
>> Subversion book, I think our tag should be:
>>
>> $Rev$ $Date$
>>
>> but Subversion doesn't seem to be handling even our existing $Date$  
>> tag.
>>
>> Anyone know what is going on?
>>
>> -dain
>>
>>


Re: Subversion keyword expansion not working

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
	The cvs2svn documentation says 'By default, cvs2svn sets 
svn:keywords on CVS files to "author id date" if the mode of the RCS file 
in question is either kv, kvl or not kb'.  I don't know whether it's case 
sensitive, or that behavior was disabled, or what -- but apparently there 
are properties on each file indicating whether keywords should be 
expanded...

	Okay, looking at the properties on the STATUS file, the 
svn:keywords is in fact set to "author date id"...  Perhaps we just need 
to change the capitalization?  An example in the "propget" documentation 
shows svn:keywords set to "Author Date Rev"...

Aaron

On Fri, 10 Sep 2004, Dain Sundstrom wrote:
> > -<!-- $Revision: 1.34 $ $Date: 2004/09/02 18:32:25 $ -->
> > +<!-- $Revision: 1.34 $ $Date$ -->
> 
> Look like Subversion doesn't like our keywords.  After checking the 
> Subversion book, I think our tag should be:
> 
> $Rev$ $Date$
> 
> but Subversion doesn't seem to be handling even our existing $Date$ tag.
> 
> Anyone know what is going on?
> 
> -dain
> 
>