views:

1098

answers:

5

My normal work flow to create a new repository with subversion is to create a new repos, do a checkout of the repos root, create my branches tags and trunk folders and place in the trunk my initial files. Then I do a commit of this "initial import", delete the checked out repos from my hard drive and do a checkout of the trunk. Then I can start working.

However, when dealing with a large import, think hundreds of megs, and off-site version control hosting (http based) this initial import can take quite a while to commit. What's worse, after committing I need to checkout this massive trunk all over again.

Is there a way with subversion to use the local copy of the trunk without doing a checkout all over again of data that is already there?

A: 

If you've checked out a single folder, copied your files into it, run svn add and svn commit; you shouldn't need to delete the files and re-checkout.

Use the files in place: once they've been committed as you describe, they're ready to be worked on.

antik
+12  A: 

There is - it's called an "in-place import", and it's covered in the Subversion FAQ here:

http://subversion.tigris.org/faq.html#in-place-import

What you're really doing is creating a new empty project in the repository, checking out the empty project your local folder - which turns your folder into a working copy - and then adding all your (existing) files to that 'empty' project, so they're added to the repository when you do an svn commit.

Dylan Beattie
+1  A: 

I usually use "svn mkdir" to create the trunk/tags/branches directly on the server immediately after creating the repository. Then I can check out the empty trunk, move my initial files into that directory, add and commit them, and start working.

Greg Hewgill
Personally I don't like to do this because it creates a bunch of unnecessary revisions in my repository. I prefer to check out the root, create the structure I need and do a single commit of the new structure.
Luke
Luke: Arguably, your source control repository will eventually contain mostly "unnecessary revisions", so I'm not sure how one extra commit will make a difference. (You can make all three directories at once with "svn mkdir dir1 dir2 dir3 -m whatever")
Greg Hewgill
+3  A: 

I agree on the "in-place import" procedure and also using a script for TTB-structure(upvoted both).

Just a small hint:

You should not import a huge (ten of thousands) number of files in a single commit, if you use http(s), as the time for displaying the version history scales by the number of added entries. The reason for this behaviour is that apache has to authenticate all added paths agains the svnaccess file(of course, only if you enabled path-based authorization). This can render your repository unusable, as all files will have to wait on a svn log for this big rev.

You should divide huge imports on directory levels

Peter Parker
Sometimes you get ownership of a project that has existed for some time but has never been under version control. Projects that use video resource can grow quite large.
Luke
that is no problem, only the number of files countsk, not their size. And this is only applicable to apache, not svn server itself
Peter Parker
+1  A: 

svn checkout --force lets you checkout a workingcopy 'over' an existing path. It keeps your old files and adds files that are only in your repository.

For creating your repository: You can perform multiple mkdir commands to a repository in a single commit using the 'svnmucc' command that is available in most Subversion distributions (e.g. SlikSVN).

Type svnmucc without arguments for some help.

Bert Huijben