0

I've created a private project and one repository at assembla.
But I've made the mistake of not following the convention with the subdirectories.
So, now there are source files in the repo root directory.
How can I move them into /trunk subdir?

Reading this question, I saw that I have to have shell access to run the svnadmin commands.
I've tried bypassing them, and succeeded only in getting a dump of the repo and creating a new one.
I am stuck at the step in which I need to load the dump into the /trunk directory - I can only load it into root again.

I see that svn move isn't a good option since there might be a case of wanting to return to an older revision, but since I am in the really early steps of the development of the project, it is unlikely for me to want to do that.
So should I try svn move? If so, how should I do that? svn move ./ ./trunk/ would do?

Community
  • 1
  • 1
Chris
  • 3,619
  • 8
  • 44
  • 64

1 Answers1

5

You've got three options.

  1. Use svn copy ^/ ^/trunk from your working copy (^/ is shorthand for the root of the repository) and then use svn delete on each file in your root. This will preserve properties you placed on the repository root such as svn:ignore. You can then use svn switch to move your checkouts to the trunk directory. If you want to checkout the history from before you do this you'll have to checkout the root of the repository at the old revisions, which may be inconvenient (this is your comment about why you might not want to use move). This method might fail depending on the version of httpd on the server side (due to a bug in Apache httpd that has been fixed). This method is documented in this question: https://stackoverflow.com/questions/16019001/svn-create-top-level-directory-and-move-everything-from-root?rq=1

  2. Create a new trunk directory and then use svn move on each file/directory in your root of your repository. This won't preserve any properties from the root directory, but saves you an extra command. You can then use svn switch to move your checkouts to the trunk directory, but since the new directory won't be related to the new directory you'll have to use --ignore-ancesstry when calling switch. If you want to checkout the history from before you do this you'll have to checkout the root of the repository at the old revisions, which may be inconvenient (this is your comment about why you might not want to use move). This method is documented in this existing question: How to create trunk directory in existing svn repo without a trunk, and move all files to new trunk?

  3. Dump your repository. When you load the repository with svnadmin load make sure to use --ignore-uuid and --parent-dir trunk. Existing checkouts will no longer be usable and you'll have to create new checkouts. You'll be able to move around in history with just a simple svn update -r $REV since all of the history will be in your trunk (well except for any branches you might make). This is documented in this question: Is there a clean way to move / to /trunk?

Which you use is really up to you. As you can see there are some tradeoffs. The first two aren't really that different. The third one is more of a pain. I'd imagine it depends on if there are other developers that will be inconvenienced by breaking their checkouts. If it's just you then I'd go ahead with the 3rd option.

Community
  • 1
  • 1
Ben Reser
  • 5,695
  • 1
  • 21
  • 29
  • Thank you for the detailed reply, Ben. The problem is that as I am using assembla I cannot use svnadmin as I don't have shell access to the server. Also, as I still don't have any svn:ignore properties in my root I just might go with the second choice. Two questions, `svn switch` simply declares the argument as the new working copy? Cause I've done these: `svn move file1 file2 dir1 dir2 trunk/` and it moved all the files from repo root and dir1 dir2 files to trunk. The two directories were left at the repo root. So I then used svn move for files of dir1 to dir1, etc. Now everything seems fine. – Chris Jan 15 '14 at 12:17
  • I then tried an `svn switch` and it failed with an error about ancenstry. So I had to run it with the flag `--ignore-ancestry` and it completed successfuly. So, now I can assume that everything is fine? – Chris Jan 15 '14 at 12:19
  • Yup sorry forgot that switch checked ancestry. I'll update my answer. – Ben Reser Jan 15 '14 at 17:14