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

Re: svn cat broken by folder rename in repository

From: François Beausoleil <fbeausoleil_at_ftml.net>
Date: 2004-08-27 16:48:46 CEST

Hello Simon,

Simon Large wrote:
>>What version of TSVN are you using ? If this version of TSVN is using
>>Subversion 1.1, then it will follow renames back in time. 1.1 has the
>>necessary code to do so.
>
>
> That's what I had hoped for when I migrated to 1.1.0.
> I am using TSVN 1.1.0 RC1, built against SVN 1.1.0 RC2.
>
> I created a repository and did some commits in TSVN as shown below:
> Create a local repository
> Create a repo directory called 'Fred' (rev 1).
> Import test.c into repository/Fred (rev 2).
> Checkout a working copy.
> Edit test.c and commit (rev 3).
> Rename test.c to newtest.c and commit (rev 4).
> Edit newtest.c and commit (rev 5).
>
> Stefan Küng has supplied the translation to svn cat commands which show the
> problem :
> svn cat path/to/wc/test.c -r5
> svn cat path/to/wc/test.c -r3
> works like a charm.
>
> svn cat url/to/test.c -r5
> works too (no surprise there)
> svn cat url/to/test.c -r3
> fails:
> svn: File not found: revision 3, path '.....'
> Clearly it is possible to get the data from the repository, but one
of the
> access methods is broken. Looks like a bug to me.

Here's a recipe that explains the problem:
cd \
rd /s/q repos wc
cls
svn --version
svnadmin create repos
svn co file:///repos wc
cd wc
echo text >test.c
svn add test.c
svn ci -m "Adding test.c"
echo some more text >>test.c
svn ci -m "Updating test.c"
svn mv test.c newtest.c
svn ci -m "Moved test.c to newtest.c"
echo Still more text >>newtest.c
svn ci -m "Updated newtest.c"

svn cat -r4 newtest.c
svn cat -r4 test.c
svn cat -r2 newtest.c
svn cat -r2 test.c
svn cat -r4 file:///repos/newtest.c
svn cat -r4 file:///repos/test.c
svn cat -r2 file:///repos/newtest.c
svn cat -r2 file:///repos/test.c

(sample runs appended at end)

Let's run through each svn cat command, and see what we're asking
Subversion:
* svn cat -r4 newtest.c
This is asking Subversion to find the URL associated with the resource
at "newtest.c", and getting whatever that URL looked like at revision 4.

* svn cat -r4 test.c
Same thing, but another resource. This resource does not exist at r4,
so this fails.

* svn cat -r2 newtest.c
This is where things get interesting. We're asking Subversion to find
the URL associated with newtest.c, and to run back through history, and
get the contents of the file at r2.

Except for svn log, 1.0.x could not follow history. So, what would
happen is that the client would ask the server for "give me the resource
named newtest.c at revision 2".

1.1.x instead does "tell me what's the name of the resource newtest.c at
revision 4 in revision 2" and then "tell me what's the content of the
previous query at r2".

* svn cat -r2 test.c
Here, both versions behave the same. We're asking for the resource
named test.c at r2.

* svn cat -r4 file:///repos/newtest.c
* svn cat -r4 file:///repos/test.c
* svn cat -r2 file:///repos/newtest.c
* svn cat -r2 file:///repos/test.c
All of these cases are the same - we're specifying a direct resource.
If the resource exists at the specified revision, bingo, we get the
contents. Else, we get a non-existent URL at revision.

I can't find it in Subversion's command help, but I believe there was a
way to specify the peg revision, which the command line client
automatically does when we use repository paths.

I hope these explanations make things clearer for you. If you need more
help, don't hesitate.

Have a nice day !
François

-----------------------------------------------------------------------------

C:\>svn --version
svn, version 1.0.6 (r10360)
    compiled Jul 24 2004, 00:01:41

...

C:\wc>svn cat -r4 newtest.c
text
some more text
Still more text

C:\wc>svn cat -r4 test.c
svn: 'test.c' has no URL

C:\wc>svn cat -r2 newtest.c
svn: File not found: revision '2', path '/newtest.c'

C:\wc>svn cat -r2 test.c
svn: 'test.c' has no URL

C:\wc>svn cat -r4 file:///repos/newtest.c
text
some more text
Still more text

C:\wc>svn cat -r4 file:///repos/test.c
svn: File not found: revision '4', path '/test.c'

C:\wc>svn cat -r2 file:///repos/newtest.c
svn: File not found: revision '2', path '/newtest.c'

C:\wc>svn cat -r2 file:///repos/test.c
text
some more text

-----------------------------------------------------------------------------

C:\>svn --version
svn, version 1.1.0 (Release Candidate 2)
    compiled Aug 13 2004, 15:20:48

...

C:\wc>svn cat -r4 newtest.c
text
some more text
Still more text

C:\wc>svn cat -r4 test.c
svn: 'test.c' has no URL

C:\wc>svn cat -r2 newtest.c
text
some more text

C:\wc>svn cat -r2 test.c
svn: 'test.c' has no URL

C:\wc>svn cat -r4 file:///repos/newtest.c
text
some more text
Still more text

C:\wc>svn cat -r4 file:///repos/test.c
svn: File not found: revision 4, path '/test.c'

C:\wc>svn cat -r2 file:///repos/newtest.c
svn: File not found: revision 2, path '/newtest.c'

C:\wc>svn cat -r2 file:///repos/test.c
text
some more text

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Aug 27 16:52:49 2004

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.