310 likes | 326 Views
Learn how to set up a Subversion repository for storing homework solutions conveniently. Follow the steps for Windows and find helpful tips for effective management.
E N D
Subversion Subversion is a brand of version control software that is frequently used to store the code and documentation of a project so as to permit earlier versions of a project to be retrieved and branches in the project to be stored and retrieved. Subversion is a centralized repository system as opposed to, say Git, which is a decentralized system. We provide a subversion repository for you to protect and submit your homework. For this purpose we prefer Subversion to other good repository systems like git.
Subversion We will use subversion in a very limited way with scripts and gui software to make your applications easy. However, you may wish to delve into the features of subversion on your own. For that purpose see subversion's documentation. If you will be working on a windows machine, a good way to handle submitting homework is the gui program tortosieSVN For a mac or windows machine, use the scripts described below.
Your local homework repository Your local repository will be the directory (on your computer) in which you save the homework solutions you wish hand in. You can use it as a solution development repository so as to save important intermediate solutions of your homework. Note however that it will be important to clearly distinguish development folders from assignment solution folders. The master repository where you will hand in your homework and where you can save your intermediate work is http://classes.cs.kent.edu/courses/cs38101/svn/F2015/yourCSUserName
Creating your local repository:Windows Open a window to the folder where you want to it to be. Right click to bring the menu at the right Select SVN Checkout to bring up the menu. Add the correcturl for the repository. Note thatthis example shows the masterrepository for Fall 2015 and the student's cs username was ruttan. Also note that output directory is listed asC:\user\ruttan\Desktop\ruttanbut for you it should beyourdirectory/yourCSUserName Click OK
Creating your local repository:Windows Enter your username and password if requested (ie not saved before):
Output from checkout:Windows The result of the checkout command should be a folder with your username on it which contain 4 files plus a hidden .svn directory and a window like the one below Note that that window tells you the location of the folder it created and the revision number which identifies the version of the data downloaded. Click OK.
Deleting local repository files: Windows Your local repository should look like exceptperhaps for the .svn which is not visibleunless (as I did) you setyour window to show hidden files. The .sh files in the repository will not be used by individuals using TortoiseSVN. So we will show how do delete them.
Highlight the files you wishto delete, right click on thehighlighted files andselect TortoiseSVN->Delete This removes the files fromthe local repository but does not remove them fromthe master repository Deleting local repository files:Windows
Updating the master repository:Windows To update themaster repositoryright click in thewindow and selectcommit
Updating the master repository: Windows Select OK toconfirm that you wish todelete the files
Updating the master repository:Windows Note the new revision number and select ok.
Adding files to your local repository Using explorer add the files shown to your local repositoryfolder except for the .svnwhich was created when the folder was checked outand which is not visibleunless (as I did) you setyour window to show hidden files.
Adding files to SVN's list:windows To inform subversion (svn) that you have add files that you want to save in the master repositoryright click in the repository folder and selectTortoiseSVN->Add
Adding files to SVN's list:Windows Deselect any files/foldersthat you don't want addedto the master folder andclick ok.
Adding files to SVN's list:Windows A list of files added is thenproduced. Click OK Nothing is actually addat this point. Only thefiles in .svn are updatedto include the new files orfolders.
Committing to the master repository:Windows With your mouse in the localrepository window right clickand select SVN Commit.
Before updatingyou will be givena list of the filesto be added. Deselect anyyou do not wishto store in themaster repository(e.g. developmentfiles). You can, if you wish,add a messageat the top toindicate thenature of the addition Click OK. Commit process:Windows
Committing process: windows Enter you CS username and password if requested. The new files/folders will be copied/deleted to the master repository. This command is atomic in that either all of the files are copiedor the master repository doesn't change. Depending on the sizeof the files this processcan take a long time Note the new revisionnumber.
SVN:Mac, Cygwin, Unix Subversion comes natively on each of these platforms, but on these subversion is a command line application. There are gui subversion applications for each of these platforms but they are not commonly used. The subversion command for add, delete, commit, and export are explained the the subversion documentation. However to assist you I have created bash scripts to invoke them.
SVN:Mac, Cygwin, Unix To use subversion directly or with the supplied bash scripts you will need to open a bash shell. On Mac's go to Applications->Utilities->Terminal. On the other platforms the command is similar. Navigate to the folder you want to use as you local repository and enter the command (with yourCSUserName replaced appropriately) svn co http://classes.cs.kent.edu/courses/cs38101/svn/F2015/yourCSUserName
SVN:Mac, Cygwin, Unix Enter your CS username and password when asked. You will be asked if you want to save it on your computer. In order to add, delete or commit, or export at the top level to the folder containing add.sh,delete.sh, commit.sh and export.sh and enter the command ./add.sh, ./delete.sh, or ./commit.sh
SVN:Mac, Cygwin, Unix To process a level below that cd to that directory and use ../add.sh, ../delete.sh, etc, To process two level below the top cd to that directory and use ../../add.sh, ../../delete.sh, etc Alternately use the absolute path to the to files add.sh, etc in the directory you wish to process.
SVN:Mac, Cygwin, Unix To process a level below that cd to that directory and use ../add.sh, ../delete.sh, etc, To process two level below the top cd to that directory and use ../../add.sh, ../../delete.sh, etc Alternately use the absolute path to the to files add.sh, etc in the directory you wish to process.
SVN:Mac, Cygwin, Unix It should be noted that these commands are not as forgiving as the TortoiseSVN versions. Once initiated this commands do not give you a choice to change the list of files. The add.sh command will affect any unadded file/directory in the subtree rooted at the directory used. The delete.sh command will remove any deleted file/directory in the subtree rooted at the directory from master repository. The commit.sh file will add/delete the added/deleted files in the subtree rooted at the directory in master repository. The export.sh command copies a clean copy from as given source directory to a output directory. The command line format is pathtoexportfile/export.sh pathtosource pathtooutput See example below.
Adding a single Directory In the previous examples we add files to the top level directory of the local repository, and then committed the entire top level to the master repository. It is possible to add the contents of just one of those subdirectories at a time to the master directory. If the subdirectory is not already in the master repository, it and all of its parents must be added from a higher level directory that is the master repository. You'll get an error if it isn't in the master Then add what ever files you wish to that subdirectory. Then open a window to that subdirectory. Performing the add and commit command in TortoiseSVN in that subdirectory will update the master repository.
Building homework solutions You should not develop your assignments in the local repository assignment folders. The development process is generally too disorganized to provide a suitably organized solution. Develop your project in some other directory on your computer. The development folder in the local repository was supplied for that purpose. Periodically commit the development folder to master repository to protect your code from loss. Use export as shown below to copy a clean solution to the appropriate assignment folder. Edit that folder to remove unnecessary files (important: you will lose points otherwise).
Submitting your assignment Update the master repository to include the assignment (execute add, commit in that folder). Go to the assignment in Blackboard and add a statement in the place for the assignment solution saying that the solution has been uploaded to the svn. If this is not done, I will not know that you have completed the assignment and it will not be graded.
Getting a clean directory tree from subversion Data in the local repository includes files specific to subversion (.svn directories and other files) that are generally not included when passing the data on to others. To make a copy of some part of the local repository data without the subversion specific files use the subversion command export Select the folder in your local repository to be exported. Right click TortoiseSVN->Export. Choose the folder you what to export it to and click OK.
Let's say you've developed assignment1in development/assgn1 as shown onthe right. Also assume that you canrun Unity in assgn1 and it works as youwant it to. To set up the folder assignment1 to handin export assgn1 to assignment1. Select assgn1, right click and selectTortioseSVN->Export Select assignment 1 and click se;ect folder.See the images produced on the on the next slide Export example: creating assignment
At this point you have copied the files inassgn1 into assignment1 without the subversion specific files that can confusesubversion. Remove any files copied but unnecessaryfiles from assignment1. Check that all required files were copiedby running Unity in assignment1. Note however the lack of a check mark onthe files in assignment1. This means thatthey have not been added to the local repository. Run svn add and commit to add the fileslocally and to the master repository Go to the assignment page in Blackboardand state that assignment1 in the master repository Export example: creating assignment