Cleaning Up After SVN Externals, the Bug and the Fix.

Posted Jul 16, 2009 // 0 comments
Irakli:

SVN externals are a convenient way to organize your subversion repository. They serve roughly the same purpose as symbolic links on a Linux filesystem. Unfortunately, there seems to be a bug that may give you a good deal of headache if you later decide to replace an svn external with an actual folder (a drop). This quick blog post describes the problem and the solution.

Problem Description

Let’s say we had created an external by running:
> svn propedit svn:externals .
and typing in the editor:
ourcomponent https://svn.example.com/someproject/trunk/subfolder/versions/v1.2

Later on, we may find a need to replace the external with an actual local copy. This is often needed if you need to start managing the component as an SVN Vendor Branch and have to turn the external into a local “drop”. To do so, you’d naturally edit the svn:externals property again (much like you did above) and empty-out the existing external. After which you’d commit the change and double-check that repo and workplace are fine. They will be fine, both your local workspace and the repository. Furthermore, anybody doing a clean checkout will also be fine, however your fellow developers, who already had a checked-out workspace version, will get the following nasty error, next time they try to update:
svn: Failed to add directory 'ourcomponent': object of the same name already exists

One Solution

Following is the solution that worked for me in cleaning corrupted workspaces, without loosing any data. I admit some of the steps are counter-intuitive and maybe even illogical, but, well, it works. Use it at your own risk:

> svn propedit svn:externals .
and delete the line that contains external.
> svn commit -m "cleaning up after svn bug" -N .
this step will actually give you an error stating that your workspace is out of date. You still need this step, though.
> svn status
> rm -rf ourcomponent
> svn update

Your workspace should be fine after the final step.

About Irakli

As our Director of Product Development, Irakli revels in developing packaged, turn-key solutions using open-source technologies and cutting-edge, semantic APIs. He brings vast expertise in the areas of: product design, development, ...

more >

Read Irakli's Blog

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <strong> <code> <p> <img> <ul> <ol> <li> <h2> <h3> <h4> <b> <u> <i>
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.