Difference between revisions of "Subversion"
Line 18: | Line 18: | ||
svn checkout file:///net/home/Tbow/svn/example/ ./ | svn checkout file:///net/home/Tbow/svn/example/ ./ | ||
svn checkout -r 1 file:///net/home/Tbow/svn/example/ ./ | svn checkout -r 1 file:///net/home/Tbow/svn/example/ ./ | ||
+ | |||
+ | In order to add files so that they will be commited use the svn command while in the working directory: | ||
+ | svn add example.java | ||
You must use this command to delete the files and then commit, | You must use this command to delete the files and then commit, |
Revision as of 13:52, 22 February 2010
Subversion is a centralized system for sharing information. At its core is a repository, which is a central store of data. The repository stores information in the form of a filesystem tree—a typical hierarchy of files and directories. Any number of clients connect to the re- pository, and then read or write to these files.
Important Note:
Make sure to always use absolute paths, for some reason subversion doesn't like relative paths when using the svn command.
Working Examples
Create an empty directory first and specify it (/net/home/Tbow/)
svnadmin create --fs-type fsfs svn/
To import a directory into svn database
svn import Example file:///net/home/Tbow/svn/example -m "Example code"
Used to checkout an already imported directory and the example directory doesn't have to be in the svn directory in order to bring it down to a working dir (./)
svn checkout file:///net/home/Tbow/svn/example/ ./ svn checkout -r 1 file:///net/home/Tbow/svn/example/ ./
In order to add files so that they will be commited use the svn command while in the working directory:
svn add example.java
You must use this command to delete the files and then commit, otherwise just removing the files (rm) will not be enough for this change to be committed.
svn delete *.class
To add new files to be commited use this command
svn add exam.java svn commit * -m "Just before cleanup of code"
This will update your current working directory from the database.
svn update
This will list all the subdirectories you imported above.
svn list file:///net/home/Tbow/svn/
This will list all the revision numbers associated with this directory in the db.
svn log file:///net/home/Tbow/svn/example/
Work Cycle
The typical work cycle looks like this:
1. Update your working copy.
svn update
2. Make changes.
svn add svn delete svn copy svn move
3. Examine your changes.
svn status svn diff
4. Possibly undo some changes.
svn revert
5. Resolve conflicts (merge others' changes).
svn update svn resolve
6. Commit your changes.
svn commit