2

(Related to: SVN externals repo "is already locked" on update)

I started off with a repository structure like this:

^/
├ module1/
│ ├ foo/
│ ├ bar/
│ ├ baz/
├ module2/

The directory ^/bar was actually a slightly antiquated copy of module2, and I decided that it would be better for it to be an external to the modern version, instead of a byte-wise copy:

^/
├ module1/
│ │ (external: "^/module2 bar")
│ ├ foo/
│ ├ baz/
├ module2/

Setting this up went smoothly:

svn co svn://module1 module1
cd module1
svn delete bar
svn propset svn:externals "^/module2 bar" .

Now I want to update the working directory so that I can perform a build & test with the new code before committing.

However, an svn update result in the following error:

Fetching external item into 'module1/bar'
svn: warning: Working copy 'module1/bar' locked

I tried svn cleanup in each directory, but a subsequent update still failed with the same error.

Is this because I'm trying to replace a directory with an external by the same name, in the same commit? Is what I want to do possible?

I am using SVN 1.8.

Community
  • 1
  • 1
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055

1 Answers1

1

Yes, that is the cause. The directory is being locked for deletion at the same time that the external's contents are trying to spawn at the same location.

You can get your working directory into a committable state by updating without externals:

svn update --ignore-externals

That prevents the incoming bar external from conflicting with the outgoing directory. However, of course, that means your external's contents won't be present. You will be able to commit now, but you'll be potentially stuck with a broken revision in SVN for the rest of time because you cannot build & test first.

There is a hacky way around this that is not ideal but will at least give you an idea of whether your new code is working. It involves moving folders around in your working directory:

svn propset svn:externals "^/module2 bar_tmp" .
svn update
rm -rf bar
mv bar_tmp bar

Now you can do your build & test with a reasonable guarantee that you're testing what you will be committing, although it is somewhat unorthodox.

Your working directory structure will look like this:

~/
├ module1/
│ ├ foo/
│ ├ bar/    (external to "^/module2")
│ ├ baz/

Don't do an svn update! You've [deliberately] butchered your working directory to an extent and the less SVN knows about that the better. You don't need SVN to do a build & test.

When you're done and happy, though, you do then need to put things back the way they were:

svn propset svn:externals "^/module2 bar" .
rm -rf bar
svn update --ignore-externals

and commit.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055