Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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.

2 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. svn status | grep '^!' | awk '{print $2}' | xargs svn delete svn status | grep "^\?" | awk '{print $2}' | xargs svn --force add svn commit -m ""

3 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

4 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 correct url for the repository. Note that this example shows the master repository for Fall 2015 and the student's cs username was ruttan. Also note that output directory is listed as C:\user\ruttan\Desktop\ruttan but for you it should be yourdirectory/yourCSUserName Click OK

5 Creating your local repository:Windows
Enter your username and password if requested (ie not saved before):

6 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.

7 Deleting local repository files: Windows
Your local repository should look like except perhaps for the .svn which is not visible unless (as I did) you set your 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.

8 Deleting local repository files:Windows
Highlight the files you wish to delete, right click on the highlighted files and select TortoiseSVN->Delete This removes the files from the local repository but does not remove them from the master repository

9 Updating the master repository:Windows
To update the master repository right click in the window and select commit

10 Updating the master repository: Windows
Select OK to confirm that you wish to delete the files

11 Updating the master repository:Windows
Note the new revision number and select ok.

12 Adding files to your local repository
Using explorer add the files shown to your local repository folder except for the .svn which was created when the folder was checked out and which is not visible unless (as I did) you set your window to show hidden files.

13 Adding files to SVN's list:windows
To inform subversion (svn) that you have add files that you want to save in the master repository right click in the repository folder and select TortoiseSVN->Add

14 Adding files to SVN's list:Windows
Deselect any files/folders that you don't want added to the master folder and click ok.

15 Adding files to SVN's list:Windows
A list of files added is then produced. Click OK Nothing is actually add at this point. Only the files in .svn are updated to include the new files or folders.

16 Committing to the master repository:Windows
With your mouse in the local repository window right click and select SVN Commit.

17 Commit process:Windows
Before updating you will be given a list of the files to be added. Deselect any you do not wish to store in the master repository (e.g. development files). You can, if you wish, add a message at the top to indicate the nature of the addition Click OK.

18 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 copied or the master repository doesn't change. Depending on the size of the files this process can take a long time Note the new revision number.

19 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.

20 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

21 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

22 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.

23 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.

24 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.

25 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.

26 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).

27 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.

28 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.

29 Export example: creating assignment
Let's say you've developed assignment1 in development/assgn1 as shown on the right. Also assume that you can run Unity in assgn1 and it works as you want it to. To set up the folder assignment1 to hand in export assgn1 to assignment1. Select assgn1, right click and select TortioseSVN->Export Select assignment 1 and click se;ect folder. See the images produced on the on the next slide

30 Export example: creating assignment

31 Export example: creating assignment
At this point you have copied the files in assgn1 into assignment1 without the subversion specific files that can confuse subversion. Remove any files copied but unnecessary files from assignment1. Check that all required files were copied by running Unity in assignment1. Note however the lack of a check mark on the files in assignment1. This means that they have not been added to the local repository. Run svn add and commit to add the files locally and to the master repository Go to the assignment page in Blackboard and state that assignment1 in the master repository


Download ppt "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."

Similar presentations


Ads by Google