svn gotchas: Importing a Folder in one step

Up until this day when my friend Gabe told me how, I didn’t know how to import a folder, without doing this first:

svn mkdir svn+ssh://server.com/path/to/repo/myfolder
svn import myFolder svn+ssh://server.com/path/to/repo/myfolder

If I didn’t do that, If I just imported the local “myFolder”, it would end up adding all the files inside the folder and it would not create the “myFolder” inside the repository, creating a total mess.

Here’s what you do
Forget everything you know about copying folders on the command line, and do this:

  • cd INTO de Local Folder you want to import as a new folder in your repository
  • svn import REMOTE_SVN_PATH/nameOfYouLocalFolder

This will create that folder as needed on the SVN repository and import all the files and folders of the folder where you’re standing.

Here’s an example:

gubatrons-macbook-pro:~/workspace/ cd arcturus-jython-console
gubatrons-macbook-pro:~/workspace/arcturus-jython-console gubatron$ svn import svn+ssh://gubatron@myserver/usr/local/svn/repos/labs/arcturus-jython-console -m "A Jython console to test arcturus core object on the fly"
Adding         Main.java
Adding         lib
Adding  (bin)  lib/jython.jar

Committed revision 7409

If you svn ls the repo, you’ll see the new folder “arcturus-jython-console” is there (for this example)

Leave a Reply

Your email address will not be published. Required fields are marked *