Mr. Boy
Mr. Boy

Reputation: 63728

TortoiseSVN folder-rename invariably fails

Whenever I rename a folder using ToroiseSVN, and then do a commit on the parent folder, it gets ugly. I typically get some weird tree conflict, and errors about SVN .tmp files/folders not existing, and other obscure messages I've never seen before. It's pretty stressful considering the folder is being deleted and supposedly recreated, what if it just gets deleted or mangled in some horrible way?

Is it better to do the rename directly on the repo, rather than on the working copy? Are these problems normal?

Upvotes: 5

Views: 5812

Answers (4)

Little Endian
Little Endian

Reputation: 830

Do not rename a folder/file if you have more than one active branch. SVN does not keep the necessary meta data to deal with it - so you will get a merge conflict. Neither does GIT. Bazaar highlights renaming as one reason to switch to their system.

Upvotes: 0

Jaco Briers
Jaco Briers

Reputation: 1715

In general, I think renaming is not a good idea when working with SVN, just because it's so easy to make a mess of it. It can get especially ugly if you have a group of developers working of the same codebase and you make use of branches.

If you are not too concerned with the change history I suggest manually making a copy of the folder (i.e. via Explorer not SVN), renaming it (again via Explorer), delete all the .svn folders inside it (so you have a clean unversioned folder), and then SVN add it (and the files inside) to the repo. Then just SVN-delete the old folder. Of course this doesn't solve the problem if someone else was editing the same source files or was using a branch, but at least it forces you to think about the implications of a rename.

Upvotes: 1

Wim Coenen
Wim Coenen

Reputation: 66733

Are these problems normal?

No. As long as you go through the TortoiseSVN menu to move/rename things, everything should work fine.

Examples of bad things you should never do:

  • moving/copying/renaming/deleting a versioned folder in your working copy with explorer
  • changing the content of .svn folders
  • deleting .svn folders (use the export feature instead)

I was involved in the training of users who migrated from VSS to SVN+TortoiseSVN. Experience show that even after years of using TortoiseSVN, users will still routinely corrupt working copies by doing one of the above. Once corrupted, it is typically infeasible to repair the working copy.

Fortunately SVN 1.7 (not yet released) will eliminate alot of this crap by centralizing metadata in one big .svn folder at the root of the working copy, like git and mercurial.

and errors about SVN .tmp files/folders not existing

You might be using xcopy to manipulate working copies. When you use xcopy to copy a folder then it will omit empty folders (unless you use the /E switch).

This will cause the .svn/tmp folders in your working copy to be omitted, effectively corrupting your working copy.

Upvotes: 2

Alan Geleynse
Alan Geleynse

Reputation: 25139

If your repository is set up well, you shouldn't have these kinds of issues. But having lots of temporary files and folders as you say you do can cause this kind of problem.

Renaming directly in the repository will probably solve most of your problems, but could still cause some difficult merge conflicts if your temporary files have been modified before the rename.

If you can, try to put any temporary files and folders into a parent folder that you can add to svn:ignore and you will get rid of a lot of these problems.

Upvotes: 0

Related Questions