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

[PATCH] fix "not locked" error message when updating an externals entry with multiple directories.

From: Ross Mark <rossm_at_controllingedge.com.au>
Date: 2004-05-11 07:46:39 CEST

This is my first submission for a patch so please excuse any clumsy
mistakes.

I couldn't see an issue for this in the issue tracker. Initially I
thought it may have been issue 1812 but on closer inspection they are
different. Rather than raising this as a new bug I though I would have a
go at fixing it myself.

The problem this addresses is if a svn:external entry checks out
multiple subdirectories any subsequent change to the svn:externals
definition will cause an error when svn tries to delete the working copy
to replace it with the new. This is because previously svn was only
creating a lock in the immediate directory and not any of the
subdirectories.

I had a quick look at the test case for the externals but I couldn't see
any obvious quick change that would allow for detecting the problem.
Increasing the directory depth would do it but for some reason when I
tried it didn't do what I expected. I have included a small shell test
script that does demonstrate the problem so people can see what I am
talking about.

Cheers

Ross Mark

PS this patch is against the trunk.

Log:
Lock the entire externals subdirectory so
svn_wc_remove_from_revision_control
doesn't error with "Working copy 'foo/bar' not locked."

* subversion/libsvn_client/externals.c
    (relegate_external): Call svn_wc_adm_open2 with a depth of -1 so
subdirectories
    are locked.

Index: subversion/libsvn_client/externals.c
===================================================================
--- subversion/libsvn_client/externals.c (revision 9672)
+++ subversion/libsvn_client/externals.c (working copy)
@@ -103,7 +103,7 @@
   svn_error_t *err;
   svn_wc_adm_access_t *adm_access;
 
- SVN_ERR (svn_wc_adm_open2 (&adm_access, NULL, path, TRUE, 0, pool));
+ SVN_ERR (svn_wc_adm_open2 (&adm_access, NULL, path, TRUE, -1, pool));
   err = svn_wc_remove_from_revision_control (adm_access,
                                              SVN_WC_ENTRY_THIS_DIR,
                                              TRUE, FALSE,

#!/bin/sh
REP=file://`pwd`/testrep
rm -rf testrep wc
#set -x
echo Create the testrep
svnadmin create testrep

echo Checking out the empty repository.
svn co -q $REP wc

echo Creating a basic file structure with one test file.
cd wc
mkdir externals
mkdir trunk
mkdir -p trunk/src/dir1
echo file1 >trunk/src/dir1/file1
svn add -q externals trunk
svn ci -m "first version" -q
svn update -q

echo Copying the trunk/src as externals/ver1
svn cp -q trunk/src externals/ver1
svn ci -m "version1" -q
svn update -q

echo Changing the contents of trunk/src/dir1/file1
echo file2 >trunk/src/dir1/file1
svn ci -m "second file"
svn update -q

echo Copying the trunk/src as externals/ver2
svn cp trunk/src externals/ver2
svn ci -m "version2" -q
svn update -q

echo Creating a lib directory for the svn:externals.
mkdir trunk/lib
svn add trunk/lib -q
svn propset svn:externals "td $REP/externals/ver1" trunk/lib
svn ci -m "extv1" -q
echo Running an update to checkout externals/ver1 as td
svn update

echo Changing svn:externals so td is externals/ver2
svn propset svn:externals "td $REP/externals/ver2" trunk/lib
svn ci -m "extv2" -q
echo Running an update to checkout externals/ver2 as td
svn update

# Now test with the externals as a completely different repository

echo
echo Create a different repository
echo

cd ..
rm -rf testrep2 wc2
REP2=file://`pwd`/testrep2
svnadmin create testrep2
svn co -q $REP2 wc2
cd wc2
date >now
mkdir subdir
echo some data >subdir/new_file
svn add -q now subdir
svn ci -m "other file data" -q

cd ../wc
svn propset svn:externals "td $REP2/" trunk/lib
svn ci -m "other rep" -q
echo Running an update to checkout a different repository as td
svn update

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 11 07:46:49 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.