Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rearranging project after SVN checkout

Tags:

svn

This is probably SVN 101, but I have to ask:

I'm working on a project that has kind of a lame directory structure. In order to get it building and running in my favorite IDE, after I check the project out, I copy the whole project to a different directory and move things around to my (and my IDE's) liking.

So my basic question is this: can I safely edit/update/merge a file that is in a different directory strcuture than the repository's directory structure?

E.g., if I check out /home/me/dev/proj/index.jsp and then copy it (and its .svn metadata) to /home/me/dev/better-proj/web/index.jsp, the fact that index.jsp resides in a different directory should be okay with regard to its SVN status, right? Wrong? Or am I just asking for trouble?

like image 759
yalestar Avatar asked Jul 16 '09 15:07

yalestar


2 Answers

You're asking for trouble. Lots of trouble. If you attempt to update the root, you'll get complete insanity as a result (lots of obstructions, "restored" files, etc). Also, how are you copying the metadata of an individual file? SVN metadata lives in a .svn folder that is per-directory. You might be able to update and commit individual directories that haven't been changed (i.e. the directory itself has been moved or renamed, but all of its children are exactly as in the repo). Then again, you might not. It's dangerous.

You should either customize your IDE to match the way the project is intended to be used/built, or rearrange the project to match how it needs to used/built. In the latter case, you'll want to investigate the svn move subcommand (i.e. svn help move). A GUI for SVN would probably also be helpful, such as TortoiseSVN (for windows) if you're going to be doing a lot of rearranging.

like image 120
rmeador Avatar answered Sep 17 '22 18:09

rmeador


If the destination is still within your working copy, use svn move (documentation). Either way, you don't ever want to manipulate the .svn metadata yourself as this will lead to conflicts and general headache.

If the destination is the working copy of another repository, you'll want to do an svn export (documentation) on the source repo followed by svn add (documentation) on the destination repo.

Also worth reading: Subversion Basic Work Cycle

like image 43
matpie Avatar answered Sep 18 '22 18:09

matpie