9

I need to move svn folder to one level up and keep all history

All files and directories from https://myserver.com/svn/Project/trunk/ into https://myserver/svn/Project/

I use a command:

svn move https://myserver.com/svn/Project/trunk/ https://myserver/svn/Project/

but it says:

svn: Cannot move path 'https://myserver.com/svn/Project/trunk/' into itself

Who knows how can I resolve that problem? Thanks!

techturtle
  • 2,519
  • 5
  • 28
  • 54
ihorko
  • 6,855
  • 25
  • 77
  • 116
  • The repository layout looks sensible. Why do you want to change it? – zellus Sep 09 '10 at 20:29
  • Have a look at http://stackoverflow.com/questions/496713/how-do-i-correct-a-subversion-project-where-i-omitted-trunk – zellus Sep 09 '10 at 20:33
  • Thanks, because trunk in my situation is just one extra chain, it's unnecessary to have it. – ihorko Sep 10 '10 at 03:23
  • As to link you send me, there guy needs add that additional directory "trunk" to the chain, i need remove it – ihorko Sep 10 '10 at 03:27

7 Answers7

21

I was just looking for this as well. Then I started looking for a solution and I didn't really find one, except that it did make me think of a solution.

You'd expect the command svn mv ./folder ./ to move everything from the ./folder to ./. This isn't actually true, it'll move folder into the current directory. Since this is where it already is, the command fails.

So, the solution would be to move everything inside ./folder to ./. Indeed, the following command does just that:

svn mv ./folder/* ./

Joost
  • 10,333
  • 4
  • 55
  • 61
11

If you are willing to use TortoiseSVN then you can simply move the folder with the repository browser. That is how I usually move folders around, very simple and painless.

Stefan Egli
  • 17,398
  • 3
  • 54
  • 75
1

I ran into a similar issue today but I didn't know how to move it up from tortoise, since I also had settings for that folder.

If the new location https://myserver/svn/Project/ should have only the items from your old location, here is what I did:

  • Moved https://myserver.com/svn/Project/trunk/ to a new temporary location (e.g. https://myserver/svn/TempProject/);

  • Deleted the existing location you want to use (https://myserver/svn/Project/);

  • Renamed https://myserver/svn/TempProject/ to https://myserver/svn/Project/.

This worked for me. It preserved all history, svn settings, etc. The history just got a couple new entries from all the moving around thing.

fasfsfgs
  • 956
  • 10
  • 16
1

I don;t know if you can move it that way, personally I would checkout repository, move folder in filesystem and then commit changes, deleting it at one location and adding at another.

Tomasz Kowalczyk
  • 10,472
  • 6
  • 52
  • 68
  • 1
    you will not keep the history, after that you will have only last revision – ihorko Sep 09 '10 at 18:54
  • why? you'll have all changes, but in new tree. – Tomasz Kowalczyk Sep 09 '10 at 22:18
  • as i thought of the problem a little bit i found another solution - dump repository at a specified tree, let's say: svnadmin dump repo/path/other/inner > file.dump then delete dir "inner" -> it will remove it from repository, and now load it at another path: svnadmin load /repo/ --parent-dir /path < file.dump that way you'll have all directory tree committed and history saved – Tomasz Kowalczyk Sep 09 '10 at 22:19
1

Try:

svn switch --relocate https://myserver.com/svn/Project/trunk/ https://myserver/svn/Project/

Please test this in a seperate repository before you run it on your real one!

Nix
  • 57,072
  • 29
  • 149
  • 198
0

I don't believe you can move directly to existing directory (especially repository root). Maybe --force option could help.

If it's possible to checkout whole repo you could move every directory from trunk to upper level, it seems like more reliable solution

svn mv * ..

* is not supported by some svn clients

Dmitry Yudakov
  • 15,364
  • 4
  • 49
  • 53
-1
  1. check out https://myserver.com/svn to some working copy
  2. delete directory "Project"
  3. copy last revision of Project/trunk to the root of the working copy
  4. commit
maxim1000
  • 6,297
  • 1
  • 23
  • 19