Upload
others
View
14
Download
0
Embed Size (px)
Citation preview
2017-01-12
1
CSCB09: Software Tools and Systems Programming
Bianca Schroeder [email protected]
IC 460 2
How is everyone doing?
• PCRS is not perfect. It’s been developed by instructors and students for free.
• PCRS is better than the alternative: Assigning readings from the text book for class prep.
PCRS
3
PCRS • Some things to keep in mind:
– Many of the initial problems have been resolved last week.
– Do not touch the lines of code that are already provided. Start below.
– If that does not work try refresh.
• Starting next week, PCRS prep will be part of
your mark. We will not look at the number of attempts to solve a question.
PCRS
4
Tutorials • We have been asked to remind everyone that
enrolment in a tutorial session is mandatory. • The deadline is this Sunday.
PCRS
2017-01-12
2
5
Feedback • Come and visit me in office hours. • There is a form for anonymous feedback on the
course web page. http://www.cs.toronto.edu/~bianca/cscb09w17/feedback.shtml
PCRS
6
Assignments
• You will also use a version control system (SVN) to submit your assignments
• On the assignments you will implement a system similar to a version control system.
• What is a version control system and what is it good for?
7
Why version control (I): Working from different machines
Bianca in her UTSc office
Lecture1.ppt
• Involves a lot of copying files around • Pain to make sure to keep versions consistent
Bianca on the TTC
Lecture1.ppt Copy
Bianca in her StG office
Lecture1.ppt Copy
8
Why version control (II): Working in a team
Alice
A1.c
• How do you coordinate changes to a file? • Option 1: Worry about it after the fact
– “Why is this broken?” – “My changes got overwritten!”
• Option 2: Exchange emails, phone calls – “I’m going to work on A1.c, so don’t touch it.”
Bob
Update Update
2017-01-12
3
9
Why version control (III): Keeping track of program changes
Alice
A1.c
• Option 1: Don’t bother – “Hope you get it right the first time” – “Hope you can remember what you changed”
• Option 2: Periodically save backups – Ad-hoc – Only programmers knows versions – Hard to pick which version to go back to – No tools to help you
Update A1.c
Update A1.c
Update
10
(Centralized) Version Control • A master copy of all files (and their previous versions) lives at
a central server • For each machine / team member: check out local copy
– Under svn: svn checkout <url of repository>!
10
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server Lecture1.ppt
Master copy
Get local copy Get local copy
Lecture1.ppt
Get
local copy
Repository
Version control • After making modifications to local copy of file, upload
changes to the server so others can see them – Under svn: svn commit –m “message describing mods”!
11 11
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server Lecture1.ppt
Master copy
Upload changes
Lecture1.ppt
Repository
Version control • After making modifications to local copy of file, upload
changes to the server so others can see them – Under svn: svn commit –m “message describing mods”!
• Note that svn stores both old and new version of file
12 12
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server
Lecture1.ppt
Master copy
Upload changes
Lecture1.ppt
Lecture1.ppt Version 1
Version 2
2017-01-12
4
Version control • Bianca now wants to continue working from her laptop:
– Need to update local copy to see changes that have been “committed” to the server
– Under svn: svn update!
13 13
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server
Dow
nloa
d ch
ange
s
Lecture1.ppt
Lecture1.ppt
Master copy Lecture1.ppt Version 1
Version 2
Repository
Version control • Bianca now realizes that edits she made in the office
were garbgage and wants back the original (blue) version – Under svn: svn update –r 1 (parameter to –r can ! ! ! ! ! !be any version #)
14 14
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server
Rev
ert
back
to
vers
ion
1
Lecture1.ppt
Lecture1.ppt
Master copy Lecture1.ppt Version 1
Version 2
Lecture1.ppt
Version control • Bianca starts working in her office on a new document • Need to tell the server to add this file
– Under svn: svn add <filename>!
• Same for new directories
15 15
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server
Lecture1.ppt
Lecture1.ppt
Master copy Lecture1.ppt Version 1
Version 2
Lecture1.ppt
Lab1.ppt
Lab1.ppt
Repository
Add new file
Version control • Commit and update operations are automatically
applied to all repository files in the current working directory (and recursively to sub-directories) that are part of the repository
16 16
Bianca in her UTSc office
Lecture1.ppt
Bianca on the TTC
Lecture1.ppt
Bianca in her StG office
Central server
Lecture1.ppt
Lecture1.ppt
Master copy Lecture1.ppt Version 1
Version 2
Lecture1.ppt
Lab1.ppt
Lab1.ppt
Repository
Add new file
2017-01-12
5
Version control • What if two users modify their local copy, Alice uploads
her changes and then Charlie tries to upload changes? – Will Charlie’s upload overwrite Alice’s changes?!
17 17
Alice
Lecture1.ppt
Bob Charlie
Central server
Has uploaded changes
Lecture1.ppt Lecture1.ppt
Lecture1.ppt
Master copy Lecture1.ppt Version 1
Version 2
Repository
Version control • What if two users modify their local copy, Alice uploads
her changes and then Charlie tries to upload changes? – Will Charlie’s upload overwrite Alice’s changes?
18 18
Alice
Lecture1.ppt
Bob
Lecture1.ppt
Charlie
Central server
Has uploaded changes
Lecture1.ppt
Also wants to upload changes
Lecture1.ppt
Master copy Lecture1.ppt Version 1
Version 2
Repository
Version control • What if two users modify their local copy, Alice uploads
her changes and then Charlie tries to upload changes? – Will Charlie’s upload overwrite Alice’s changes?
19 19
Alice
Lecture1.ppt
Bob
Lecture1.ppt
Charlie
Central server Lecture1.ppt
Master copy
Has uploaded changes
Lecture1.ppt
Also wants to upload changes
No! If the master copy has changed since Charlie last
updated his local copy, when Charlie tries to commit his copy the server will notify him of the differences between his local
copy and the master copy and ask him which should prevail or
to submit a merged version.!
A1 • When a users issues a commit on a repository, the
server needs to check which local files are different from the master copy.
• Option 1: send all files in the local repository to the server to compare against the master copy – slow and a lot of network traffic
• Option 2: the server sends a checksum or hash value for each file; the client computes a checksum for each of its local files; the client only sends those files that have a different checksum.
• As part of A1 you will implement a program that can compute a simple hash function.
20 20