You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Manuel Pégourié-Gonnard <mp...@elzevir.fr> on 2010/06/11 14:09:12 UTC

$Rev$ expanded differently in two up-to-date checkouts?!

Hi,

Consider the following scenario: someone copies a directory, then commit. Inside
this directory, there are a few files with the $Rev$ keyword set to be expanded.
Another user  updates his working copy to the same revision. Both look at the
expansion of the $Rev$ keyword in the files: they are not the same.

I'm quite surprised, since I would have expected this to be independent of the
working copy used (as long as it's up-to-date, obviously).

Example (current working directory printed before shell prompt):

$ svnadmin create repo
$ svn co file://$PWD/repo active
Checked out revision 0.
$ svn co file://$PWD/repo passive
Checked out revision 0.
$ cd active
(active) $ svn mkdir dir
A         dir
(active) $ echo '$Rev$' > dir/file; svn add dir/file
A         dir/file
(active) $ svn propset svn:keywords Rev dir/file
property 'svn:keywords' set on 'dir/file'
(active) $ svn ci -mdummy
Adding         dir
Adding         dir/file
Transmitting file data .
Committed revision 1.
(active) $ svn cp dir newdir
A         newdir
(active) $ svn ci -mdummy
Adding         newdir

Committed revision 2.
(active) $ head -v */file
==> dir/file <==
$Rev: 1 $

==> newdir/file <==
$Rev: 2 $
(active) $ cd ../passive
(passive) $ svn up
A    newdir
A    newdir/file
A    dir
A    dir/file
Updated to revision 2.
(passive) $ head -v */file
==> dir/file <==
$Rev: 1 $

==> newdir/file <==
$Rev: 1 $
(passive) $

Now, another funny point: in the "active" working copy, do "svn up -r1; svn up"
and then you've got the same keyword expansion as in the "passive" copy.

I'm a bit annoyed, because:
1. I don't understand why it works this way.
2. I have some scripts relying on the value of the expanded Rev keyword (or,
equivalently, the 3rd field in the output of svn status -v), and I'd like them
to give the same result in all up-to-date checkouts.

Can someone please enlighten me? Thanks in advance.

Manuel.

Re: $Rev$ expanded differently in two up-to-date checkouts?!

Posted by Kevin Grover <ke...@kevingrover.net>.
I get the same thing: svn 1.6.5, Ubuntu 9.10.  Doesn't seem right.

For grins, I checked out a NEW copy of the repo, and it looks like passive

+ svn co file:///$PWD/repo new
+ head -v new/newdir/file
==> new/newdir/file <==
$Rev: 1 $

svn st reports clean in all WCs.


On Fri, Jun 11, 2010 at 14:56, Manuel Pégourié-Gonnard <mp...@elzevir.fr>wrote:

> Le 11/06/2010 21:42, Mike Dixon a écrit :
> > On 6/11/2010 7:09 AM, Manuel Pégourié-Gonnard wrote:
> >> Consider the following scenario: someone copies a directory, then
> commit. Inside
> >> this directory, there are a few files with the $Rev$ keyword set to be
> expanded.
> >> Another user  updates his working copy to the same revision. Both look
> at the
> >> expansion of the $Rev$ keyword in the files: they are not the same.
> >>
> >> I'm quite surprised, since I would have expected this to be independent
> of the
> >> working copy used (as long as it's up-to-date, obviously).
> >
> > After committing, your working copy is not up-to-date. You need to
> > explicitly call svn update.
> >
> Right, I forgot this step in my test script, but it was done in the real
> situation where I first noticed this behaviour.
>
> Anyway, it doesn't change anything to this problem. Below is the new
> version of
> the script I'm using to test this, and its output. As you can see, I'm
> doing a
> svn up in the two working copies just before looking at the files, but
> still get
> different values for the expanded $Rev$.
>
> Manuel.
>
> ===== reproducer script =====
> #!/bin/sh
>
> LC_ALL=C; export LC_ALL
> set -x
>
> svnadmin create repo
> svn co file://$PWD/repo active
> svn co file://$PWD/repo passive
> cd active
> svn mkdir dir
> echo '$Rev$' > dir/file
> svn add dir/file
> svn propset svn:keywords Rev dir/file
> svn ci -mdummy
> svn cp dir newdir
> svn ci -mdummy
> cd ..
> (cd passive && svn up)
> (cd active && svn up)
> head -v */newdir/file
>
> ===== script output =====
> + svnadmin create repo
> + svn co file:///home/mpg/tmp/svnfoo/repo active
> Checked out revision 0.
> + svn co file:///home/mpg/tmp/svnfoo/repo passive
> Checked out revision 0.
> + cd active
> + svn mkdir dir
> A         dir
> + echo $Rev$
> + svn add dir/file
> A         dir/file
> + svn propset svn:keywords Rev dir/file
> property 'svn:keywords' set on 'dir/file'
> + svn ci -mdummy
> Adding         dir
> Adding         dir/file
> Transmitting file data .
> Committed revision 1.
> + svn cp dir newdir
> A         newdir
> + svn ci -mdummy
> Adding         newdir
>
> Committed revision 2.
> + cd ..
> + cd passive
> + svn up
> A    newdir
> A    newdir/file
> A    dir
> A    dir/file
> Updated to revision 2.
> + cd active
> + svn up
> At revision 2.
> + head -v active/newdir/file passive/newdir/file
> ==> active/newdir/file <==
> $Rev: 2 $
>
> ==> passive/newdir/file <==
> $Rev: 1 $
>

Re: $Rev$ expanded differently in two up-to-date checkouts?!

Posted by Manuel Pégourié-Gonnard <mp...@elzevir.fr>.
Le 11/06/2010 21:42, Mike Dixon a écrit :
> On 6/11/2010 7:09 AM, Manuel Pégourié-Gonnard wrote:
>> Consider the following scenario: someone copies a directory, then commit. Inside
>> this directory, there are a few files with the $Rev$ keyword set to be expanded.
>> Another user  updates his working copy to the same revision. Both look at the
>> expansion of the $Rev$ keyword in the files: they are not the same.
>>
>> I'm quite surprised, since I would have expected this to be independent of the
>> working copy used (as long as it's up-to-date, obviously).
> 
> After committing, your working copy is not up-to-date. You need to 
> explicitly call svn update.
> 
Right, I forgot this step in my test script, but it was done in the real
situation where I first noticed this behaviour.

Anyway, it doesn't change anything to this problem. Below is the new version of
the script I'm using to test this, and its output. As you can see, I'm doing a
svn up in the two working copies just before looking at the files, but still get
different values for the expanded $Rev$.

Manuel.

===== reproducer script =====
#!/bin/sh

LC_ALL=C; export LC_ALL
set -x

svnadmin create repo
svn co file://$PWD/repo active
svn co file://$PWD/repo passive
cd active
svn mkdir dir
echo '$Rev$' > dir/file
svn add dir/file
svn propset svn:keywords Rev dir/file
svn ci -mdummy
svn cp dir newdir
svn ci -mdummy
cd ..
(cd passive && svn up)
(cd active && svn up)
head -v */newdir/file

===== script output =====
+ svnadmin create repo
+ svn co file:///home/mpg/tmp/svnfoo/repo active
Checked out revision 0.
+ svn co file:///home/mpg/tmp/svnfoo/repo passive
Checked out revision 0.
+ cd active
+ svn mkdir dir
A         dir
+ echo $Rev$
+ svn add dir/file
A         dir/file
+ svn propset svn:keywords Rev dir/file
property 'svn:keywords' set on 'dir/file'
+ svn ci -mdummy
Adding         dir
Adding         dir/file
Transmitting file data .
Committed revision 1.
+ svn cp dir newdir
A         newdir
+ svn ci -mdummy
Adding         newdir

Committed revision 2.
+ cd ..
+ cd passive
+ svn up
A    newdir
A    newdir/file
A    dir
A    dir/file
Updated to revision 2.
+ cd active
+ svn up
At revision 2.
+ head -v active/newdir/file passive/newdir/file
==> active/newdir/file <==
$Rev: 2 $

==> passive/newdir/file <==
$Rev: 1 $

Re: $Rev$ expanded differently in two up-to-date checkouts?!

Posted by Manuel Pégourié-Gonnard <mp...@elzevir.fr>.
Le 11/06/2010 21:42, Mike Dixon a écrit :
> On 6/11/2010 7:09 AM, Manuel Pégourié-Gonnard wrote:
>> Consider the following scenario: someone copies a directory, then commit. Inside
>> this directory, there are a few files with the $Rev$ keyword set to be expanded.
>> Another user  updates his working copy to the same revision. Both look at the
>> expansion of the $Rev$ keyword in the files: they are not the same.
>>
>> I'm quite surprised, since I would have expected this to be independent of the
>> working copy used (as long as it's up-to-date, obviously).
> 
> After committing, your working copy is not up-to-date. You need to 
> explicitly call svn update.
> 
Right, I forgot this step in my test script, but it was done in the real
situation where I first noticed this behaviour.

Anyway, it doesn't change anything to this problem. Below is the new version of
the script I'm using to test this, and its output. As you can see, I'm doing a
svn up in the two working copies just before looking at the files, but still get
different values for the expanded $Rev$.

Manuel.

===== reproducer script =====
#!/bin/sh

LC_ALL=C; export LC_ALL
set -x

svnadmin create repo
svn co file://$PWD/repo active
svn co file://$PWD/repo passive
cd active
svn mkdir dir
echo '$Rev$' > dir/file
svn add dir/file
svn propset svn:keywords Rev dir/file
svn ci -mdummy
svn cp dir newdir
svn ci -mdummy
cd ..
(cd passive && svn up)
(cd active && svn up)
head -v */newdir/file

===== script output =====
+ svnadmin create repo
+ svn co file:///home/mpg/tmp/svnfoo/repo active
Checked out revision 0.
+ svn co file:///home/mpg/tmp/svnfoo/repo passive
Checked out revision 0.
+ cd active
+ svn mkdir dir
A         dir
+ echo $Rev$
+ svn add dir/file
A         dir/file
+ svn propset svn:keywords Rev dir/file
property 'svn:keywords' set on 'dir/file'
+ svn ci -mdummy
Adding         dir
Adding         dir/file
Transmitting file data .
Committed revision 1.
+ svn cp dir newdir
A         newdir
+ svn ci -mdummy
Adding         newdir

Committed revision 2.
+ cd ..
+ cd passive
+ svn up
A    newdir
A    newdir/file
A    dir
A    dir/file
Updated to revision 2.
+ cd active
+ svn up
At revision 2.
+ head -v active/newdir/file passive/newdir/file
==> active/newdir/file <==
$Rev: 2 $

==> passive/newdir/file <==
$Rev: 1 $

Re: $Rev$ expanded differently in two up-to-date checkouts?!

Posted by Mike Dixon <mi...@denovosoftware.com>.
On 6/11/2010 7:09 AM, Manuel Pégourié-Gonnard wrote:
> Consider the following scenario: someone copies a directory, then commit. Inside
> this directory, there are a few files with the $Rev$ keyword set to be expanded.
> Another user  updates his working copy to the same revision. Both look at the
> expansion of the $Rev$ keyword in the files: they are not the same.
>
> I'm quite surprised, since I would have expected this to be independent of the
> working copy used (as long as it's up-to-date, obviously).

After committing, your working copy is not up-to-date. You need to 
explicitly call svn update.

http://svnbook.red-bean.com/nightly/en/svn.basic.in-action.html#svn.basic.in-action.mixedrevs.update-commit

-Mike

Re: $Rev$ expanded differently in two up-to-date checkouts?!

Posted by Mike Dixon <mi...@denovosoftware.com>.
On 6/11/2010 7:09 AM, Manuel Pégourié-Gonnard wrote:
> Consider the following scenario: someone copies a directory, then commit. Inside
> this directory, there are a few files with the $Rev$ keyword set to be expanded.
> Another user  updates his working copy to the same revision. Both look at the
> expansion of the $Rev$ keyword in the files: they are not the same.
>
> I'm quite surprised, since I would have expected this to be independent of the
> working copy used (as long as it's up-to-date, obviously).

After committing, your working copy is not up-to-date. You need to 
explicitly call svn update.

http://svnbook.red-bean.com/nightly/en/svn.basic.in-action.html#svn.basic.in-action.mixedrevs.update-commit

-Mike