23
Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at http://svnbook.red-bean.com and slides written by Dr. Mark L. Hornick

Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Embed Size (px)

Citation preview

Page 1: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Introduction to Version Control

SE-2030Dr. Rob Hasker

1

Based on material at http://svnbook.red-bean.com/ and slides written by Dr. Mark L. Hornick

Page 2: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

2

The stages of developing a software application

Requirements Analysis High-level Design [Plan] Low-level Design Implementation [Unit Test] Integration System Test Deploy Maintain

Page 3: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

In many cases, multiple projects run concurrently

New features are typically being added to the next version

While at the same time, defects need to be corrected in existing releases

SE-2030Dr. Rob Hasker

3

Page 4: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

On a single project, a team of software engineers work together toward a release

All team members work on the same code and develop their respective parts

An engineer may be responsible for anything from a whole subsystem to a few methods within a particular class

SE-2030Dr. Rob Hasker

4

Page 5: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Files have to be shared among developers on a team project

Shared files can be kept in some type of Repository where they can be accessed and worked on by multiple individuals

SE-2030Dr. Rob Hasker

5Image: http://svnbook.red-bean.com/

Harry and Sally get their own respective Working Copies of the Master File in the Repository

Page 6: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

This can lead to big problems…

SE-2030Dr. Rob Hasker

6Image: http://svnbook.red-bean.com/

Adds some method Modifies some other method

Page 7: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The problem to avoid:

SE-2030Dr. Rob HaskerImage: http://svnbook.red-bean.com/

Harry’s changes are still held locally…

Page 8: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Harry’s changes are lost

SE-2030Dr. Rob HaskerImage: http://svnbook.red-bean.com/

‘’

‘’

Page 9: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Your SVN repository URL:

https://emerald.msoe.edu/svn/se2030-smithj

SE-2030Dr. Rob Hasker

9

Page 10: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The Lock-Modify-Unlock solution

SE-2030Dr. Rob HaskerImage: http://svnbook.red-bean.com/

Sally must wait until Harry releases the lock

Microsoft Visual SourceSafe follows this model

Page 11: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Lock-Modify-Unlock only allows a single user to edit the file at a time

SE-2030Dr. Rob HaskerImage: http://svnbook.red-bean.com/

Page 12: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Lock-Modify-Unlock has its own drawbacks:

Harry has to remember to release his lock before Sally (or anyone else) can acquire the lock in order to edit

Sally has to wait for Harry to finish before editing… Harry might be adding some new methods Sally just wants to add a few comments to an

existing method

SE-2030Dr. Rob Hasker

12

Page 13: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The Copy-Modify-Merge Solution

SE-2030Dr. Rob Hasker

13Image: http://svnbook.red-bean.com/

Page 14: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The Repository recognizes conflicts

SE-2030Dr. Rob Hasker

14Image: http://svnbook.red-bean.com/

Harry is prevented from writing

Page 15: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The Repository allows versions of the file to be compared for differences

SE-2030Dr. Rob Hasker

15Image: http://svnbook.red-bean.com/

Page 16: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The Repository keeps both users synchronized

SE-2030Dr. Rob Hasker

16Image: http://svnbook.red-bean.com/

Page 17: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Copy-Modify-Merge is actually very easy to use and manage

Users can work in parallel

Most of the time, concurrent changes don’t overlap People generally don’t edit exactly the

same code simultaneously Amount of time spent resolving conflicts is

nearly always less than the time that would be spent waiting for a lock to be released

SE-2030Dr. Rob Hasker

17

Page 18: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Is Lock-Modify-Unlock ever needed?

When two or more people need to work on the same file, the simultaneous changes may not be mergable in all cases: MS Word documents Image documents EA design documents

SE-2030Dr. Rob Hasker

18

Page 19: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The Repository can also manage and track differences between parallel revisions of a document

Typically, a software product will undergo revisions (2.0, 2.1, 3.0) while the original version continues to be maintained

SE-2030Dr. Rob Hasker

19Image: http://svnbook.red-bean.com/

Page 20: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Subversion is an open-source version control system that is available for many platforms

Windows Mac Linux

Many current open-source projects (like Eclipse) use Subversion to maintain source code control http://subversion.tigris.org/

SE-2030Dr. Rob Hasker

20

Page 21: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Subversion in SE2030

The Subversion Repository for SE2030 is installed on emerald.msoe.edu – a Linux server accessible via the MSOE network

In order to access the Repository, you need a Subversion Client that can read and write files to and from the Repository on the server

SE-2030Dr. Rob Hasker

21

Page 22: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

The TortoiseSVN Subversion Client

TortoiseSVN is a SourceForge open-source client application for the Windows platform

There are similar client applications for Mac and Linux Mac - http://scplugin.tigris.org/ Linux (KDE) - http://kdesvn.alwins-world.de/ Wikipedia comparison of various clients is at

http://en.wikipedia.org/wiki/Comparison_of_Subversion_clients

SE-2030Dr. Rob Hasker

22

For more info, see http://tortoisesvn.net/

Page 23: Introduction to Version Control SE-2030 Dr. Rob Hasker 1 Based on material at //svnbook.red-bean.com/ and slides written

Homework

Install TortoiseSVN on your PC – needed for lab this week http://emerald.msoe.edu/resources/doku.php?

id=courses:se-2030:installing_tortoisesvn

Read more about Version Control http://emerald.msoe.edu/resources/doku.php?

id=courses:se-2030:version_control

SE-2030Dr. Rob Hasker

23

Links are also on course web page