Difference between revisions of "Subversion"
Line 1: | Line 1: | ||
− | Create an empty directory first and specify it (/net/home/Tbow/ | + | 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. |
− | + | ||
+ | [http://nuclear.unh.edu/wiki/images/7/72/svn-book.pdf Subversion Documentation v1.5] | ||
+ | |||
+ | '''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 | 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 | Used to checkout an already imported directory and | ||
the example directory doesn't have to be in the svn | the example directory doesn't have to be in the svn | ||
directory in order to bring it down to a working dir (./) | 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/ ./ | |
You must use this command to delete the files and then commit, | You must use this command to delete the files and then commit, | ||
otherwise just removing the files (rm) will not be enough for | otherwise just removing the files (rm) will not be enough for | ||
this change to be committed. | this change to be committed. | ||
− | + | svn delete *.class | |
To add new files to be commited use this command | 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. | This will update your current working directory from the database. | ||
− | + | svn update | |
This will list all the subdirectories you imported above. | 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 will list all the revision numbers associated with | ||
this directory in the db. | 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 | |
− |
Revision as of 03:18, 21 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/ ./
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