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?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With