Do not copy SVN working folders to another location in project

This one has had me tearing my hair out - until I discovered what the issue was:

Scenario

  • I copied a folder from one folder to another folder in my working copy for a project
  • I subsequently committed the whole project (a few days later) (seemed to commit ok)
  • After committing the project, I noticed that when I performed an update, it was showing that the files in the old folder had been updated. - This was strange, as no-one else had access to the repository at the time
  • Another colleague started working on the project, but the folder I had copied, did not appear when they performed an update - indeed, it did not appear to be in SVN at all.
  • When I checked the source folder, I could see that this contained the copied (and edited) version of the files - rather than the original files.
  • I then checked the SVN properties of the copied files in Eclipse - and it was clear that the SVN URL of the copied files was the same as the source files!

What Happened:

So what I assume must have happened, is that as I copied the folder, I also copied the SVN subfolder with it - which had all the references to the original SVN location...

Resolution:

  • I deleted the copied folder, and recreated it.
  • I then copied the files from the original folder (these were the ones that had been edited as my edits to the copied folder had been checked in over them)
  • When I then performed an update, Subclipse correctly identified them as New - and I was able to commit them to the repository in the correct location.
  • I then also had to go back to the source folder, retrieve the previous version of the files, and re-commit them.

Fortunately this was noticed relatively quickly - and only affected a small number of files - otherwise it could have been quite a nightmare to resolve!

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
JesterXL's Gravatar Another solution; don't use Subclipe. Instead, make 2 dirs:

- dev
- local

Work from local. Check out code from SVN into dev. When you are ready to commit your code:

- update dev
- use a diff tool (like BeyondCompare) to shuttle files to dev, make comparisons, merge, etc.
- commit

That way, you can move to your heart's content.
# Posted By JesterXL | 17/08/07 19:16
Dan Lancelot's Gravatar Hi Jester,

Thanks for the advice.

I don't think I could cope with working that way tbh - too much going back and forth - I'm certain I would end up not checking in changes / overwriting the wrong stuff...

Now I'm aware of the issue, I will be careful to ensure it does not cause any more problems - its not often that I want to copy whole folders within a project, so I don't think it will be too much of an issue.
# Posted By Dan Lancelot | 17/08/07 19:33
Adam Fortuna's Gravatar Man, i've had that problem many times and continue to make the mistake of moving svn folders around. I'd been able to get around it the same way as you in the past, but I think removing the .svn folders outside of eclipse, then updating the project might work.
# Posted By Adam Fortuna | 17/08/07 20:52
Mark Phippard's Gravatar There are a couple of open Eclipse bugs related to this. They do not provide any kind of hook, like they do for move/rename, to allow a team provider like Subclipse to capture the copy and do the right thing. The second problem is that Eclipse knows the .svn folders should not be copied and does not do it in other instances, but still does in this case.

In Subclipse we added two options: Team > Copy and Team >Export to allow you to copy stuff and have it handled properly.
# Posted By Mark Phippard | 17/08/07 21:03
Dan Lancelot's Gravatar Looking through the Subclipse team menu - I stumbled across the Copy Command:
http://svn.collab.net/subclipse/help/topic/org.tig...

I wonder if this will do the job:

Select the resource you want to copy and choose Copy from the Team context menu. Select the target repository directory for the copy operation and click OK to initiate the copy. The selected resource is copied to the working copy associated with target repository directory selected and automatically added to version control.

Whilst it seems like this command is meant for copying from one project to another project - It looks like it would probably work within a project as well...

- Tried it - and it appears to work fine :) Copied a folder within a project - and SVN URL updated correctly - although the destination does need to be in SVN already...
# Posted By Dan Lancelot | 17/08/07 21:07
Dan Lancelot's Gravatar Thanks Mark - that confirms it then :)

(Post Overlap there!)
# Posted By Dan Lancelot | 17/08/07 21:12
Erik's Gravatar Two years later this issue still exists.

Subclipse -> copy does not behave properly with subfolders. It will do one folder fine, but if there are folders under it, they do not get copied correctly.
# Posted By Erik | 25/09/09 16:43
BlogCFC was created by Raymond Camden. This blog is hosted by DotLance Ltd.