Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is on Win2k3sp2, using TortoiseSVN 1.6.5 and SlikSVN 1.6.3.

I have a folder in a repo, call it /a/b, which I want to become /a/c/d in the same repo. I have tried just moving the folder and renaming it, and then committing, and apparently it gets confused, because the .svn folder thinks it's still under the old name, and if it does work, it's a two-commit thing where /a/b is deleted and /a/c/d is brand new, which is no good, because then I lose the history attached to each file.

I started poking around and found "relocate," which comes with a huge warning and convinces me not to use it. Then there's "switch," which, although I thought "relocate" was a more intuitive way of describing what I wanted to do, seemed to be the appropriate option. So I did that, and it took a long time, even though there were only a few files within /a/b (like maybe 8 folders, each containing a file or two), and now:

  1. /a/b is still there
  2. half the folders in /a/b are gone
  3. the remaining folders in /a/b give me an error when I try to look inside them: "/a/b/e is not accessible. Access is denied."
  4. /a/c/b (not /a/c/d as I had told it!) was created but stayed empty
  5. I tried an update and now some folders are back in /a/b, but not all

My question then is in two parts:

  1. How do I clean this up?
  2. What's the proper way to move a folder as I described?
share|improve this question

3 Answers 3

up vote 4 down vote accepted

Your problem is having used the wrong command; 'Switch' does the exact complement of what you wanted - it changes the repository location your working copy 'points at', without changing the repository. (Switch then commit would have produced some result, but in a really broken way which isn't what you meant. You were right; the tempting-sounding 'Relocate' is a special case of 'Switch', and should be avoided for the same reason.)
The 'Update' command then updated the working copy to match what was currently in the repository at the 'new' location - nothing!

Subversion doesn't have a true move/rename yet. The subversion-safe way to do it is to copy and then delete. TortoiseSVN includes a handy 'move' option which does a copy-and-delete as one operation.

The easiest way to do what you wanted:
1. Open repo-browser in TortoiseSVN.
2. Right-click and drag the folder from its old location to the new one.
3. Select 'Move' from the context menu.

This also works inside your working copy, and is the safe Tortoise/Subversion way to move or rename files and folders in the wc without losing history.

share|improve this answer
    
So...you lose history either way? Is that true of CVS and git? I feel like I do this operation often enough... –  Kev Oct 23 '09 at 15:05
    
Oh, wait, it seems to keep the history okay, it's just hidden by default on the Show Log screen. –  Kev Oct 23 '09 at 15:10

To move the files properly, use the move command.

EDIT:
Note, move, mv, rename, ren are aliases for the same command. It can be found in TortoiseSVN under "TortoiseSVN" -> "Rename..." see here

share|improve this answer
    
+1 for being true, although the reason I never found it was that it's not in the TortoiseSVN context menu. –  Kev Oct 23 '09 at 15:11
    
@Kev: Check my answer again, I edited it. Move can be found under rename. –  Tim Büthe Oct 28 '09 at 8:51

to answer your second point, here's how I move folders with Tortoise-SVN:

  • right click in Windows explorer on a folder, then 'Tortoise SVN', then 'Repo-browser'.
  • in repo browser, make your you are looking at where-the-folder-you-want-to-move-is.
  • click on the folder (or file!) to move and drag it on the left pane where you want it to be
  • click OK to close the repo browser
  • right-click in your folder and 'Update'.

When you update, Tortoise SVN will delete the folder where it was and re-create it where you moved it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.