+ All Categories
Home > Documents > Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control...

Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control...

Date post: 05-Aug-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
24
Methods: Version Control Module Website: http://www.cs.nott.ac.uk/lad/SWT Labs are in the Middle Row of A32 every Thursday and Friday from 2pm until 4pm. See website for details. Remember Lab exercises will be assessed in the Exam! NB. I only rarely answer queries sent by email. Please use the module noticeboard.
Transcript
Page 1: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Methods: Version ControlModule Website:

http://www.cs.nott.ac.uk/∼lad/SWT

Labs are in the Middle Row of A32 every

Thursday and Friday from 2pm until 4pm. See

website for details.

Remember Lab exercises will be assessed in

the Exam!

NB. I only rarely answer queries sent by email.

Please use the module noticeboard.

Page 2: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

By the end of this Lecture youshould be able to..

• Describe the principles behind version

control systems and explain what problems

they address.

• Describe the Copy-Modify-Merge cycle.

• Explain how Locking and Version Tracking

avoid conflicts and discuss the benefits of

each technique.

Page 3: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Version Control

Things change ...

• New Requirements lead to

• New or changed designs that lead to

• New or changed source code, etc.

• or bugs are discovered and must be fixed

...software engineers need to keep track of allthese changes

Page 4: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Version Control Systems Support

Synchronisation Manages the changesmade by different programmers so theydon’t need to continually email codebetween each other.

Rollback Changes are not always animprovement. Often you need to return to aprior version.

Experimentation Lets software engineersexplore “what if” scenarios.

Page 5: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Internationlization Different versions for

different languages.

Historical Record A customer reports a bug

on version 1.1 but you are at version 2.3.

You need a way to recreate version 1.1 to

check out the bug.

Page 6: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Tracking Changes

1

2

3

4

5

2.1

Another bug fix,release asversion 1.1

First draft of code, buggy

Fix some bugs, release version 1.0

Begin adding spellcheck feature

spellcheck feature complete, may have bugs

changes merged, more bugs fixed, release as version 2.0

Page 7: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Version Graphs

• All changes to a single file are tracked via a

graph

– nodes are distinct versions

– edges denote that the target node was

derived from the source node

Page 8: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

• There are three possible configurations

Extension A single version derived from a

single version

Split Multiple versions derived from a single

one

Merge A single version derived from multiple

versions; most systems have support for

this much major differences have to be

resolved by hand.

Page 9: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Version Control FilesGraphs are stored (centrally) in version controlfiles

Space saving techniques may be used.

• Forward deltas – The original version isstored, all subsequent versions are storedas sets of changes or “deltas”.

• Backward deltas – The most recent versionis stored, all previous versions are storedas sets of changes.

Page 10: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Version Control Systems

A Version control system lets you “check out”

versions of a version control file.For instance, if I ask for version 2.2, and weare using a forward delta system, it starts withthe original file and applies all of the deltasthat lead to version 2.2 in the version graph

Page 11: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Checking OutCENTRAL REPOSITORY

BOB CHARLIEALICE

File 1

File 1 File 1File 2

Checkout

Checkout

Checkout

• Alice and Charlie have checked out all files.

• Bob has just checked out File 2.

Page 12: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Copy-Modify-Merge

1. A Developer copies the version of the

system they are interested into their own

filespace.

2. They then make any changes they want to

the system.

3. This is then merged back into the central

version (which may have been modified by

other developers in the meantime).

Page 13: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Copy-Modify-Merge (Alice Modifies

a File)

File 1

CENTRAL REPOSITORY

File 1

File 1

ContentsFile 1

Contents

ALICE

Modify

Merge

Copy

Page 14: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Alice modifies a file followed by

Bob

File 1

ContentsFile 1

Contents

File 1

Page 1

Contents

File 1

Page 1

File 1 File 1

File 1

Contents

Merge

Merge

Modify

Modify

BOB ALICECENTRAL REPOSITORY

Contents

Copy

Copy

Page 15: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Alice, Bob, Alice

File 1

ContentsFile 1

Contents

File 1

Page 1

Contents

File 1

Page 1

File 1 File 1

File 1

Contents

Merge

Merge

Modify

Modify

BOB ALICECENTRAL REPOSITORY

Contents

File 1

Page 1

Modify

Copy

Copy

Copy

Contents

Page 16: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

ConflictsSuppose Alice and Bob both copy the samefile, make some changes and then try tomerge them. What Happens?

Page 17: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

A Conflict

File 1 File 1

File 1

Contents

Merge

Modify

BOB ALICECENTRAL REPOSITORY

CopyFile 1

Copy

Modify

File 1Page 1

Merge

!

Page 18: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Locking or Version TrackingVersion Control Systems vary in how theycope with conflicts.

• Some systems implement locking so it isimpossible for two people two both have afile checked out at the same time.

• Other systems may keep track of theversions of a file each user has and requirethem to update their version before theycan merge it.

Page 19: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

File Locking in Action

File 1 File 1

BOB ALICECENTRAL REPOSITORY

Copy

Modify

File 1

Contents

MergeFile 1

Contents

File 1

File Locked

File 1

Contents

Modify

! Copy

Copy

Error: File Locked

Page 20: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Version Tracking in Action

File 1 File 1

BOB ALICECENTRAL REPOSITORY

CopyFile 1

Copy

File 1

Contents

MergeFile 1

Contents

File 1

Contents !Error: New VersionFile 1Page 1

Merge

Modify

File 1

ContentsUpdateFile 1

Contents

File 1Page 1

Conflict Resolution

File 1

ContentsPage 1

File 1

ContentsPage 1

Merge

Modify

Page 21: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Conflict Resolution

• Many version control systems support

conflict resolution making guesses about

an appropriate way to merge the two

versions of the file.

• In the end though they will give up and

leave it to the user to do this by hand.

Page 22: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Locking Vs. Version Tracking

• Locking prevents complicated conflict

resolution problems arising.

• Locking also prevents duplication of effort

(two programmers both doing the same

thing at the same time).

Page 23: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

• Version tracking prevents one person’s

work being held up because someone else

is using the file they want – or worse still

has forgotten to check the file back in.

• Version tracking allows two developers to

work on different sections of the same file

at once.

Page 24: Methods: Version Control - cgi.csc.liv.ac.uklad/portfolio/version_control.pdf · Version Control Systems A Version control system lets you “check out” versions of a version control

Summary

• Version Control Systems are a way of

tracking and recording changes to a

software project.

• They help teams of people coordinate their

work.

• They are not psychic! unless they are a

central part of a project methodology they

are more trouble than they’re worth!


Recommended