Difference between revisions of "Subversion"

From Nuclear Physics Group Documentation Pages
Jump to navigationJump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.
+
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. If you're looking for information about our Subversion server, click [[Gourd#Subversion|here]]
  
[http://nuclear.unh.edu/wiki/images/7/72/svn-book.pdf Subversion Documentation v1.5]
+
[[Subversion Server]]
 +
 
 +
==Subversion Guides==
 +
[http://nuclear.unh.edu/wiki/pdfs/Subversion-Book-1.5.pdf Subversion Documentation v1.5]
 +
[http://nuclear.unh.edu/wiki/pdfs/Subversion_Cheat_Sheet.pdf Subversion Cheat Sheet]
  
 
'''Important Note:'''
 
'''Important Note:'''
  Make sure to always use absolute paths, for some reason subversion doesn't like relative paths when using the svn command.
+
Make sure to always use absolute paths, for some reason subversion doesn't like relative paths when using the svn command.
 +
 
 +
==Subversion over HTTP==
 +
This explains and shows some examples of commands used in uploading and downloading code from a subversion web server (svn://).
 +
To import the initial code:
 +
svn import junit  --username jared --password shipit svn://opteron1/svn-repo
 +
To checkout the same code:
 +
svn checkout --username jared --password shipit svn://opteron1/svn-repo
 +
To commit to the svn server after making any improvements use these commands to commit the changes to the server:
 +
svn commit
 +
svn commit <file name>
 +
svn commit <directory name>
 +
All the info that is needed to commit changes to the server is in the working directory as .svn directories.
 +
To add files use the svn add command from below while in the working directory you checked out.
 +
To update your code from the server:
 +
svn update
 +
svn update <file name>
 +
svn update <directory name>
  
 
==Working Examples==
 
==Working Examples==

Latest revision as of 15:10, 24 October 2012

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. If you're looking for information about our Subversion server, click here

Subversion Server

Subversion Guides

Subversion Documentation v1.5
Subversion Cheat Sheet

Important Note:

Make sure to always use absolute paths, for some reason subversion doesn't like relative paths when using the svn command.

Subversion over HTTP

This explains and shows some examples of commands used in uploading and downloading code from a subversion web server (svn://). To import the initial code:

svn import junit  --username jared --password shipit svn://opteron1/svn-repo

To checkout the same code:

svn checkout --username jared --password shipit svn://opteron1/svn-repo

To commit to the svn server after making any improvements use these commands to commit the changes to the server:

svn commit
svn commit <file name>
svn commit <directory name>

All the info that is needed to commit changes to the server is in the working directory as .svn directories. To add files use the svn add command from below while in the working directory you checked out. To update your code from the server:

svn update
svn update <file name>
svn update <directory name>

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