Hi Aslesh,

Hi,

I have a question about the behavior of svn checkout. Here is the scenario:

I have a standard trunk, branches, tags structure for one of my apps in a repo and I created a branch, say at revision 500 of trunk.

Later, I delete the branch and the recreate another branch with the same name and at the same revision 500 of trunk.

Now I’m trying to check out the branch at revision 500. I know that the branch doesn’t exist at r500 (it will be some higher revision), only trunk does and it probably doesn’t make sense to check out a branch at that revision; but I’m interested in knowing why this behavior occurs and if it is expected.

svn co <REPO_URL>/branches/<BRANCH>@500 à svn info on that gives the URL as expected i.e. <REPO_URL>/branches/<BRANCH>

svn co -r 500 <REPO_URL>/branches/<BRANCH> à svn info on that gives an unexpected result i.e. <REPO_URL>/trunk

Shouldn’t subversion complain that the branch doesn’t exist at revision 500?

If it has checked out without complaining, why does svn info using the second way of checkout show the unexpected result?

Which version of SVN are you using?
I just tried to reproduce the behavior you are describing here using SVN 1.9.4.

For the first test (aka: co with a peg-revision prior to the creation of the branch) I'm getting the expected svn error: "svn: E170000: URL '<REPO_URL>/branches/<BRANCH>' doesn't exist". Could it be possible that you somehow mistook the revisions in your case and the branch in fact already existed in revision 500?


The second case brings up some different behavior on my test run too - and I can't quite make out much sense here (even after refreshing my memories re-reading the peg revision algorithm):

(note: r1 was the initial creation of trunk/branches/tags folders in my test repository --- 'a' was the name of the test branch I created)
Running in E:\test:
svn co -r 1 <REPO_URL>/branches/a resulted in:
Checked out revision 1.

However, that then working directory in a subdirectory E:\test\a (instead of one in E:\test). If I change the svn co-command and explicitly specify the wc-path, I get the same result you are describing (aka: co of trunk instead of the branch):
svn co -r 1 <REPO_URL>/branches/a .

TBH I would have expected the same outcome as you are describing (aka: some error, since the branch to be checked-out is not present in the given operative revision). I've attached a repro case (Windows batch file) for this. Maybe some of the SVN developers can catch that up and make some sense out of that?

I take it there are two separate questions at hand here:
1) Why does the svn co command not error out, if specifying a path which doesn't exist in the operative revision? 2) Why does the svn co command create a subdirectory 'a' instead of taking the specified URL as the path to checkout entirely?

--
Regards,
Stefan Hett

@echo off

rem 
##############################################################################
rem ##                                                                          
##
rem ##  This is a template for writing Subversion bug reproduction scripts.     
##
rem ##                                                                          
##
rem ##  It creates a repository containing the standard Greek Tree (see         
##
rem ##  
http://svn.apache.org/repos/asf/subversion/trunk/subversion/tests/greek-tree.txt)
 ##
rem ##  and checks out a working copy containing that tree.  Please adjust      
##
rem ##  this script however you need to to demonstrate your bug.  When it's     
##
rem ##  ready, post the bug report to d...@subversion.apache.org -- after       
 ##
rem ##  
http://subversion.apache.org/docs/community-guide/issues.html#reporting-bugs, ##
rem ##  of course.                                                              
##
rem ##                                                                          
##
rem 
##############################################################################

:defineCommands
rem You might need to adjust these lines to point to your
rem compiled-from-source Subversion binaries, if using those:
for %%i in (svn.exe) do set SVN="%%~$PATH:i"
for %%i in (svnadmin.exe) do set SVNADMIN="%%~$PATH:i"

:defineUrls
rem Only supported access method: file://. If http:// or svn://, then
rem you'll have to configure it yourself first.
set URL=file:///%CD%/repos
set URL=%URL:\=/%
echo Base url for repo: %URL%

:cleanAllDirsAndCreateRepo
if exist repos rmdir /s /q repos
if exist import-me rmdir /s /q import-me
if exist wc rmdir /s /q wc
%SVNADMIN% create repos

:prepareGreekTree
echo Making a Greek Tree for import...
mkdir import-me
mkdir import-me\trunk
mkdir import-me\tags
mkdir import-me\branches
mkdir import-me\trunk\A
mkdir import-me\trunk\A\B\
mkdir import-me\trunk\A\C\
mkdir import-me\trunk\A\D\
mkdir import-me\trunk\A\B\E\
mkdir import-me\trunk\A\B\F\
mkdir import-me\trunk\A\D\G\
mkdir import-me\trunk\A\D\H\
echo This is the file 'iota'.        > import-me\trunk\iota
echo This is the file 'A\mu'.        > import-me\trunk\A\mu
echo This is the file 'A\B\lambda'.  > import-me\trunk\A\B\lambda
echo This is the file 'A\B\E\alpha'. > import-me\trunk\A\B\E\alpha
echo This is the file 'A\B\E\beta'.  > import-me\trunk\A\B\E\beta
echo This is the file 'A\D\gamma'.   > import-me\trunk\A\D\gamma
echo This is the file 'A\D\G\pi'.    > import-me\trunk\A\D\G\pi
echo This is the file 'A\D\G\rho'.   > import-me\trunk\A\D\G\rho
echo This is the file 'A\D\G\tau'.   > import-me\trunk\A\D\G\tau
echo This is the file 'A\D\H\chi'.   > import-me\trunk\A\D\H\chi
echo This is the file 'A\D\H\omega'. > import-me\trunk\A\D\H\omega
echo This is the file 'A\D\H\psi'.   > import-me\trunk\A\D\H\psi
echo Importing it...
cd import-me
%SVN% import -q -m "Initial import." %URL%
cd ..

:checkoutTrunk
echo Checking out working copy..
%SVN% co -q %URL%/trunk wc

rem This is where your reproduction recipe goes.
%SVN% cp %URL%/trunk %URL%/branches/a -m"Created branch a"
md testWC
cd testWC
REM why does the following command not issue an SVN error
REM note: it would, if branches/a doesn't exist on HEAD
%SVN% co -r 1 %URL%/branches/a
cd ..

goto :eof

Reply via email to