Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem Solving With C++ SVN ( Version Control ) April 2016.

Similar presentations


Presentation on theme: "Problem Solving With C++ SVN ( Version Control ) April 2016."— Presentation transcript:

1 Problem Solving With C++ SVN ( Version Control ) April 2016

2 Introduction

3 Subversion is a free/open-source version control system. That is, Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed. Subversion is a way to version your code (or anything else for that matter). You can make changes to any file, commit the changes to a repository, and revert to any version of your code. This is useful if you accidentally delete a file. You can simply recheck it out! You can also compare your current code with old versions of the code that you wrote in the past.

4 Creating a Repository svnadmin create DIRECTORY This will create an empty repository in DIRECTORY. DIRECTORY should either not exist or be an empty directory.

5 Adding your code to your empty repository svn import PATH-TO-CODE PATH-TO-REPO -m "Initial code“ PATH-TO-CODE is the location of your code PATH-TO-REPO is the location of your repository in one of the following forms: file://path svn+ssh://path http://path Examples: file:///s/bach/a/class/cs253/CurrentSemester/pub/repo svn+ssh://coconuts.cs.colostate.edu/s/bach/a/class/cs253/CurrentSemester/pub/repo If your repo is on the CS machines, you will likely use the file:// format while on the CS machines and the svn+ssh:// format all other times.

6 Checking out your code To make modifications to your repository, you need to checkout the code you have added to it. The code you imported into your empty repository is not linked to your repository, so we need to get a new copy that is linked. svn checkout PATH-TO-REPO DIRECTORY-FOR-CODE PATH-TO-REPO is of the same form that we used when adding the code to the empty repository. DIRECTORY-FOR-CODE is an optional parameter that tells svn where to put the checked out copy of your code. This defaults to a directory in the current path named identical to the name of the repository.

7 Making changes to your code Once you have a SVN linked copy of your code through the checkout command, you can start making changes or updates to your code. svn add, svn delete, svn copy, and svn move svn add filename svn copy PATH DESTINATION You can see the changes you have made using svn status This shows you which files have been created (?/A), modified (M), and deleted (!/D). You can add the -u flag to svn status -u to request an update from the repository to see the changes that have occured remotely. As you make changes to your code, you can track the exact modifications with svn diff This will show you what has been added and removed from individual files.

8 If you make a mistake and want to "erase" the changes you have made to a file, you can execute the following to undo almost any change back to the last revision. svn revert FILE-PATH As you are working, you can schedule the changes that you have made to take place in the repository. These changes may be immediately reflected in your copy, but won't be seen in the repository until you commit them. Schedule a file, directory, or symbolic link to be added to the repository. If PATH is a directory, everything underneath it will also be scheduled for addition. svn add PATH Schedule a file, directory, or symlink to be deleted from the repository. svn delete PATH

9 When you are satisfied with the changes you have scheduled. You can commit them to the repository for others to use and for a versioned history of your modifications with the following command. svn commit –m “message” To display all the log messages svn log PATH OF DIRECTORY To checkout a previous pervious version of your code svn update –r1 To check difference between two versions svn diff –r r1:r2

10 Assignment 1.Create a Subversion repository for your assignment code using svnadmin create. 2.Import your code into the repository. 3.Checkout a copy of your code 4. Show the GTA the output of svn list showing the files in your repository.


Download ppt "Problem Solving With C++ SVN ( Version Control ) April 2016."

Similar presentations


Ads by Google