Difference between revisions of "Svn"

From CSE473 Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''(Needs updating for Fall 2015 and new SVN organization being set up by EIT)
+
This year, our labs are hosted on [https://bitbucket.org bitbucket], which is a version control system that uses [https://bitbucket.org git].  If you are not familiar with git, [https://www.learnenough.com/git-tutorial here is a reasonably good tutorial] on how it works and how to use it.  It is written for Unix/Linux and from a command line perspective, but should provide you with a good overview of what git does and how to use it. 
'''
 
  
An svn repository has been setup for each student on shell.cec.wustl.edu. These will be used in connection with labs and studios, including to submit your lab assignments. SVN is an open-source [http://svnbook.red-bean.com/ version control system] that allows multiple users working on a common set of files to synchronize through a server (the repository). Repositories can be accessed using any of a number of svn clients.  SVN clients come native on most Unix distributions including MAC OSX and Linux.  There are also a number of GUI-based SVN clients for Windows, the MAC and Linux.  On Windows, [http://www.tortoisesvn.net TortoiseSvn] is a nice client that is available on the Urbauer labs machines.
+
For those who are familiar with svn, another version control software, the two are very similar when it comes to the steps involved in getting stuff from and to the remote repository that you will use to both get lab assignments and for submitting your solution code and reports. The main difference between the two is that while svn only requires a ''commit'' operation, git requires a three step process (see Figure 4 of the [https://www.learnenough.com/git-tutorial tutorial]), namely ''stage'' (this uses <span style="font-family:Courier;">''git add''</span>) that makes a new or modified file (or files) ready to be committed, ''commit'' (this uses <span style="font-family:Courier;">''git commit''</span>) that makes the new/changed files part of your local repository, and finally ''push'' (this uses <span style="font-family:Courier;">''git push''</span>) that ultimately uploads your new or modified file to the remote repository.
  
The first time you use your SVN client to access a repository, you need to first "checkout" a local copy of the repository on your machine.  
+
The '''MOST COMMON''' mistake students make is to omit the <span style="font-family:Courier;">''git push''</span> command, so that while their solution is correctly updated in their local repository, this final version is not propagated to the remote directory that we use to timestamp submissions and grade.  You should, therefore, '''always''' make sure to verify that you have uploaded your lab solution and report to the remote repository and done a <span style="font-family:Courier;">''git push''</span> before the lab due date.
  
To checkout a working copy of the CSE 473 labs repository on a unix/linux system, type the following within a shell window. (These instructions assume that svn is installed on your computer - if not, you can download it from the subversion web site - http://subversion.apache.org/).
+
As far as getting access to the remote repository is concerned, you will receive an invitation email that will include instructions on how to get a local copy of the repository on your machine(s). You will need an account on [https://bitbucket.org bitbucket], and if you don't already have one, you will be givent the opportunity to create one.
  
svn checkout https:/svn.seas.wustl.edu/repositories/<wustlkey>/cse473_fl15/
+
Once you have a local copy of the repository on a machine, you can sync it up with the remote repository using a ''pull'' command, ''i.e.,'' <span style="font-family:Courier;">''git pull''</span>. This will update your local repository to mirror the content of the remote repository.  You will need to do this before each new lab assignment to retrieves copies of the files associated with the assignmentYou will be sent an email reminding you to do so.
 
 
You should substitute your own WUSTL Connect Key login name in place of "yourConnectKey".
 
 
 
You will be prompted for a password. Use your Connect Key password. Once you have checked out a copy of your repository, you will see a new directory (folder) with the same name as your repository. Do a cd to this directory and take note of the various files and sub-directories that now appear there.
 
 
 
If you are using TortoiseSvn on a Windows PC, open Windows explorer and create a new folder in an appropriate location (or use an existing folder, if you already have one where you want to download the repository to). Right-click within the empty folder to bring up a "context menu", which should include an SVN checkout menu item. Selecting this will bring up a dialog box in which you can enter the URL for your repository. This takes the form
 
 
 
https://shell.cec.wustl.edu:8443/cse473_fl14/svn/yourConnectKey/
 
 
 
Proceed as described above.
 
 
 
There are two basic functions to svn: '''update''' and '''commit''', which synchronize your local copy with the repository.<br>
 
The '''update''' command (''svn update'' from command line) downloads into your local copy any file for which the repository has a newer version.  If you do not specify an individual file name, it recursively checks for modified files "downward" (in the file system) from where you invoked the command.  If you invoke the command at the roor of the repository, it will check for updated files in the entire repository.  Asking the repository for an updated copy of an individual file simply requires appending its name after the command, i.e., ''svn update filename'' (or selecting if from the GUI menu).<br>
 
The '''commit''' command (''svn commit'' from command line) uploads back to the repository files that you have been modifying. Again, if you do not specify any file name, it recursively uploads any modified versioned file. This allows others to download them (with the update command).  Again, you can ask to commit a single file by appending its name after the command i.e., ''svn commit filename'' (or selecting if from the GUI menu).  Note that when you commit a file, you will usually be asked to enter a short description of the changes you have made.  You can bypass this (from command line) using the "-m" option and adding a short blurb of text between quotation marks, i.e., svn commit -m "text" filename (optional).
 
 
 
The other command you will need to use is the '''add''' command, ''svn add'', which as its name indicates will identify that a new file needs to be added to the repository, i.e., be versionedIt can be applied to either a directory or a specific file.  Many GUIs actually give the option to add an entire new directory and its content in one operation, or for existing directories to check for "unversioned" files, i.e., files that have not yet been added, and select them all.<br>
 
'''NOTE''': After you have added a file to the repository, you still need to issue a '''commit''' command to have it actually uploaded to the repository, i.e., it is a two-step process (again, some client allow you to combine the add and commit operation).
 

Latest revision as of 19:13, 18 August 2017

This year, our labs are hosted on bitbucket, which is a version control system that uses git. If you are not familiar with git, here is a reasonably good tutorial on how it works and how to use it. It is written for Unix/Linux and from a command line perspective, but should provide you with a good overview of what git does and how to use it.

For those who are familiar with svn, another version control software, the two are very similar when it comes to the steps involved in getting stuff from and to the remote repository that you will use to both get lab assignments and for submitting your solution code and reports. The main difference between the two is that while svn only requires a commit operation, git requires a three step process (see Figure 4 of the tutorial), namely stage (this uses git add) that makes a new or modified file (or files) ready to be committed, commit (this uses git commit) that makes the new/changed files part of your local repository, and finally push (this uses git push) that ultimately uploads your new or modified file to the remote repository.

The MOST COMMON mistake students make is to omit the git push command, so that while their solution is correctly updated in their local repository, this final version is not propagated to the remote directory that we use to timestamp submissions and grade. You should, therefore, always make sure to verify that you have uploaded your lab solution and report to the remote repository and done a git push before the lab due date.

As far as getting access to the remote repository is concerned, you will receive an invitation email that will include instructions on how to get a local copy of the repository on your machine(s). You will need an account on bitbucket, and if you don't already have one, you will be givent the opportunity to create one.

Once you have a local copy of the repository on a machine, you can sync it up with the remote repository using a pull command, i.e., git pull. This will update your local repository to mirror the content of the remote repository. You will need to do this before each new lab assignment to retrieves copies of the files associated with the assignment. You will be sent an email reminding you to do so.