Can I use the existing file system as subversion repository?
May 7, 2009 1:27 PM   Subscribe

Can I checkout the files to the same folder I imported them from using subversion? Or do I need a new location for the checkout?

I asked a similar question some time back. This here is slightly different.

I understand better now that with Subversion I make a repository, and then you import the folders/files which I want to keep under revision control into that freshly made repository. I can then toss the originals after ensuring the import was successful. Then I check out the project from the repository into what is called a working repository. Ok. Good.

However, I have current projects in a very nice folder system and I really don't want to have to reshuffle everything. As I understand it, I can import these projects into a repository, and when I check them out I use a new location on my computer. But I want to retain the existing structure!

Would I import, then toss the files from the current folder they were in, then checkout to that same, but now empty, folder? Am I missing anything?
posted by steppe to Computers & Internet (6 answers total)
 
Nope thats it.

I usually save the folder (just rename it folder.bak) and then checkout. Also generally when importing a new project I usually have trunk/ tags/ branches/ folders with my project in the trunk directory (the other two are empty) I then check out the contents of the trunk folder.

This makes tagging and branching easier later on.
posted by bitdamaged at 1:36 PM on May 7, 2009 [1 favorite]


I guess you can just try it and find out. Import as usual, then instead of deleting your originals and checking out elsewhere, see what happens if you try to check out over the originals. The worst case scenario is that it doesn't work, in which case you can just delete the directory as usual. Best case is that svn is smart enough to do it correctly and it saves you from having to delete the stuff or shuffle folders.

It seems like you may need to use the --force option when you checkout. See here.
posted by benign at 2:45 PM on May 7, 2009


Sure you can. I do it all the time.
posted by capnsue at 3:13 PM on May 7, 2009


It's all on the filesystem so it's not really impossible. But if you were more experienced you would probably see this isn't a particularly helpful or useful idea, and trying to fake out subversion isn't a good idea in general. You get the benefits from SCM when you embrace it, not when you try to lie to it.

What folks usually do is something like this:

Check in your crud. Check it out in a new directory, make sure it's all there. Blow away your new directory (it was just a test) and your old directory (or move it aside). Then check out the project as what your old directory was called.
posted by chairface at 4:18 PM on May 7, 2009


You can't create a checkout inside a local working copy, if that's what you're asking.
posted by Kadin2048 at 5:37 PM on May 7, 2009


Best answer: There is a little known trick that does exactly what you want. Here's how to do it:
  svnadmin create --fs-type fsfs ~/repositories/slash-etc-svnrep
  cd /etc
  svn co ~/repositories/slash-etc-svnrep . 
  svn add *
  svn ci -m 'initial add of everything'

Notice the dot at the end of the checkout command. This indicates that you want to turn the current directory into a working directory. I wrote about this trick in my Subversion starter article.
posted by gmarceau at 6:24 PM on May 7, 2009


« Older I want to play with your octopus (literally)   |   Looking for a good pediatrician near Potrero Hill... Newer »
This thread is closed to new comments.