Difference between revisions of "Subversion"

From Embedded Xinu
Jump to navigation Jump to search
(Revamped to make more readable)
(Marked page as historical (due to switch to git))
(9 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[w:Subversion (software)|Subversion]] is the source code control system that the [[XINU]] project uses to maintain its code base.  All repositories are hosted by the [http://mulug.mscs.mu.edu Marquette University Linux Users Group] and are available for access by anyone who is part of the XINU team or upon special request.  Below is an explanation of how to use subversion (svn) and the layout of the repository.
== Common Commands ==
A [http://acm.mscs.mu.edu/wiki/Subversion general use guide] is now available on the [http://acm.mscs.mu.edu/ Student ACM Wiki].  Also there is a posting of commands in the Cudahy 310 Computer Lab.
''If you ever forget a command, there is a list posted in CU 310.''
Xinu specific information about the repository is available in the [[trac:Subversion|trac wiki]].
There are many subversion commands at your fingertips, but only 3-5 of them are used on a daily basis.  In this section we cover the <code>update</code>, <code>commit</code>, <code>checkout</code>, <code>add</code>, <code>remove</code>, and <code>status</code>.  All commands can be executed from any subversion checkout.  In our example we will assume our working copy is located at <tt>~/xinu</tt> and our repository is located at <tt>https://xinu.mscs.mu.edu/svn/mips/trunk</tt>.
=== <code>checkout</code> ===
''This command is aliased with <code>svn co</code>.''
Checkout will create a new working copy of a repository on your local machine.  This is done through the command:
svn checkout https://xinu.mscs.mu.edu/svn/mips/trunk ~/xinu
You may have to enter a username and password.
=== <code>update</code> ===
''This command is aliased with <code>svn up</code>.''
Update will synchronize a working copy with the most recent version stored in main repository.  While updating, all files that have been changed will display a status flag:
* <tt>A</tt> -- A file was successfully added to the working copy.
* <tt>D</tt> -- A file was successfully deleted to the working copy.
* <tt>U</tt> -- A file was successfully updated in the working copy.
* <tt>C</tt> -- Subversion failed to update the working copy to the most recent version.  This must be <tt>resolved</tt>.
* <tt>G</tt> -- Subversion successfully merged the working copy and the most recent version.
So, from our working copy we can type the command:
svn update
Once the update is complete you should be "at revision 1428."
=== <code>commit</code> ===
''This command is aliased with <code>svn ci</code>.''
Commit will send local changes on a working copy to the main repository.  It is greatly recommended that you <code>update</code> prior to committing, otherwise it is possible that a failure will occur.  To commit changes, use the command:
svn commit
Optionally you can provide a list of files to commit if you do not want all your changes sent to the main repository.  Every commit has an associated log message which is written using your editor of choice after typing the command.  If you have not set an <code>$EDITOR</code> variable for you shell, you must do that (for bash this is done by <code>export EDITOR=vim</code> where <tt>vim</tt> is your editor of choice).
=== <code>status</code> ===
''This command is aliased to <code>svn st</code>.''
Status will let you see what files you have changed in your working copy as compared to the most recent version from the main repository.  The same flags are associated with the <code>status</code> command as with the  <code>update</code> command.  To view these changes, run the command:
svn status
=== <code>add</code> & <code>remove</code> ===
''The <code>remove</code> command is aliased with <code>svn delete</code>, <code>svn del</code>, and <code>svn rm</code>.''
After viewing a status you may face files with the flags <tt>!</tt> or <tt>?</tt>.  These mean a file is missing (<tt>!</tt>) or subversion does not know about a file (<tt>?</tt>).  Typically files with an <tt>!</tt> imply that they have been removed from the working copy, but subversion has not been informed about this change.  To do this, run:
svn remove path/to/file
And subversion will change the status to <tt>D</tt>.  If you are removing a file using the subversion command will remove the file from the file system as well, if you remove a directory tree the tree will be removed after the commit.
Similarly, if a file has the <tt>?</tt> flag associated with it, subversion does not know it has to add the file to the working copy.  Like the remove command, this can be run by:
svn add path/to/file
If you add a directory tree, subversion will recursively add all files below the parent as well as the parent node.
Remember, none of these changes will be stored in the main repository until you <code>commit</code>!
== Other Commands ==
If ever you want a detailed description of a command (or just a list of commands) you can use subversions help feature.  <tt>svn help</tt> will provide a listing of the commands that are supported, while <tt>svn help <command></tt> provides a detailed description of what that command does.
This should cover the majority of commands used in daily subversion usage.  If you want to know more about subversion the online [http://svnbook.red-bean.com/en/1.4/svn-book.html subversion book] is an excellent resource.

Latest revision as of 22:00, 11 September 2013

✘ This page is currently inactive and is retained primarily for historical interest.
A historical page is usually one that is no longer maintained or no longer relevant.

A general use guide is now available on the Student ACM Wiki. Also there is a posting of commands in the Cudahy 310 Computer Lab.

Xinu specific information about the repository is available in the trac wiki.