Subversion
From TechWiki
For installing and configuring subversion see Subversion Version Control System
Subversion and Eclipse see Development Subversion
Contents |
Basics
svn status svn info svn help svn help command
Import Local Files
You have local unversioned files on your computer and would like to copy them into the subversion repository, starting a new project. Use
svn import localDir [repo]
where [repo] can be something like
http://my.server.com/pathToSvn/
or
file:///pathToSvn/
See svnbook.red-bean.com.
Initial Checkout
You know there are files in the subversion directory you would like to checkout the project locally. This is an initial checkout:
svn checkout http://my.server.com/pathToSvn/
From svnbook.red-bean.com.
Revert To Older Revision
svn merge -rHEAD:1234 .
svn:ignore
Eclipse's dot-files (e.g., .classpath) and the directories containing the binaries are registered and marked as changes by subversion. So although your code is identical to the repository, subversion tags the project in eclipse as 'edited'.
To get subversion to ignore local setups, you need to use the ignore option. Note however, that eclipse can't do this (results in revision conflicts) and you need to do this in the terminal.
Go to the directory and type
svn status
to see something like
M . ? .classpath
Then
svn propset svn:ignore .classpath .
and commit
svn commit
Type some text in the emacs editor and 'Ctrl-x' and 'Ctrl-s' to save and 'Ctrl-x' and 'Ctrl-c' to exit the editor.
For multiple files and directories use
svn propedit svn:ignore .
and add the entries into the editor. Note that wild cards work and for directory names one should omit the '/' at the end. After committing you can always look at the ignore patterns for the current directory by executing
svn propedit svn:ignore .
once again.
See also http://svnbook.red-bean.com/en/1.1/ch07s02.html
Problems
Ignoring directories is sometimes a pain.
If
svn st
gives you
? data/arch
and you want to ignore arch, go to directory data and
svn propedit svn:ignore .
(you can also stay in the current directory and use svn propedit svn:ignore ./data) Then you simply add
arch
When you do svn st you should only get
M .
with arch being invisible.
Remove .svn Folders
Using Linux (what else;-)
find . -name '.svn' -type d -exec rm -rf {} \;
Moving Repository Location
Move a directory in the repository (an immediate commit, so it requires a commit message):
svn move -m "Moving" http://svn.site.com/repos/dir http://svn.site.com/repos/newDir
Note that
http://svn.site.com/repos/newDir
must exist.
However, in your working copy you must redirect the URL:
svn info
tells you the current one. Theoretically, I think, you must use
svn switch http://svn.site.com/repos/newDir
Unfortunately, as I had current changes, this all didn't really work that well: after the switch
svn status
gave me many and strange changes. So I made a backup, deleted the working copy, did a checkout and put the modified files in by hand :-(
See also the option
svn switch --relocate
for more...
