Subversion Tutorial Version Control Menggunakan TortoiseSVN.
Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server...
Transcript of Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server...
![Page 1: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/1.jpg)
ìComputer Systems and NetworksECPE 170 – Jeff Shafer – University of the Pacific
Version Control
![Page 2: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/2.jpg)
Lab Schedule
ì Todayì Lab 2 – Version Control
ì Next Weekì Intro to C (for C++ programmers)ì Lab 3 – C Programming / Build Tools
ì Deadlinesì Lab 1 Report – Jan 26th, 2019 by 5am
ì Submit via Canvasì Lab 2 Report – Jan 29th, 2019 by 5am
ì Submit via version control
Spring 2019Computer Systems and Networks
2
![Page 3: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/3.jpg)
Before Version Control
1. <Report.doc>
2. <Report.doc.bak>
3. <Report-1.doc>
4. Email off to partner…
5. <Report-2.doc>
6. Partner responds with doc(that is missing the changes you just made)
7. <Report-2a.doc>
8. <Report-2a-WITH-REFERENCES.doc>
9. Email off to partner…Partner responds with new doc<Report-3.doc>
10. <Report-3-FINAL.doc>
11. <Report-3-FINAL-OOPS-FIXED-TYPO-FINAL.doc>
Spring 2019Computer Systems and Networks
3
![Page 4: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/4.jpg)
Version Control Features
ì Project history tracking
ì Concurrent file editing (merges)
ì Non-linear program history (branches)
ì Naming scheme for program releases (tags)
Spring 2019Computer Systems and Networks
4
![Page 5: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/5.jpg)
Motivation for Version Control
ì Why would a single programmer (working alone) use version control?ì Backup filesì Roll-back to earlier (working) versionì See changes made between current (broken) code
and earlier (working) codeì Maintain multiple versions of a single productì Experiment with a new feature
ì Try a risky change in a “sandbox”ì If it works, you can merge it into the regular code.
If it fails, you can throw it away.
Spring 2019Computer Systems and Networks
5
![Page 6: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/6.jpg)
Motivation for Version Control
ì Why would a small group of developers use version control?ì All the reasons a single programmer would, plus…ì Merging different changes made by different
developers into the same fileì Add a new function at the bottom? Safe to
automatically merge inì Re-write a function at the same time another
developer is also editing it? Version control will catch this and ask you to decide which edits should “win”
ì Blame – who wrote this buggy code?!?
Spring 2019Computer Systems and Networks
6
![Page 7: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/7.jpg)
Motivation for Version Control
ì Why would a large group of developers use version control?
ì Different question: Could you develop the Linux kernel, Adobe Photoshop, Google Chrome, etc… using:ì A single shared “folder of code”?ì Emailing code snippets between developers?ì Everyone sits around and shares one keyboard?
Spring 2019Computer Systems and Networks
7
![Page 8: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/8.jpg)
Version Control Basics
ì What kind of files should I keep in version control?ì Program source code (obviously)ì VHDL / Verilog files (from digital design class)ì Matlab scriptsì HTML filesì Server configuration files
ì Imagine you work at Livermore National Labs, and your job is to manage Linux cluster computers with 100,000+ machines (nodes)…
ì Anything that is plain text!
Spring 2019Computer Systems and Networks
8
![Page 9: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/9.jpg)
Version Control Basics
ì What kind of files should I not keep in version control?
Spring 2019Computer Systems and Networks
9
https://www.youtube.com/watch?v=WJVBvvS57j0
![Page 10: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/10.jpg)
Version Control Basics
ì What kind of files should I not keep in version control?ì These are more what you’d call “guidelines” than actual
“rules”…ì Binary data
ì How do you merge two different binary files together? No general-purpose way to do this
ì Anything auto-generated by the compilerì Object files or executable fileì Wastes space on useless junk that can be re-created
automaticallyì Text editor temp files (e.g. main.c~)
Spring 2019Computer Systems and Networks
10
![Page 11: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/11.jpg)
Version Control Basics
ì Big risk in putting the executable in version controlì If you forget to compile before a commit, the
executable may not be in sync with the attached source code!
ì Big headache if you ever roll back to this version!
ì In ECPE 170, all our executable files can be produced in under 5 seconds with one command. There’s no need to include them in your repository
Spring 2019Computer Systems and Networks
11
![Page 12: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/12.jpg)
Problem 1 – Comparison
ì How are these Version Control Systems different?ì Mercurialì Gitì SVN
Spring 2019Computer Systems and Networks
12
P1
![Page 13: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/13.jpg)
Distributed Version Control
ì Why do they call Mercurial a distributed version control system?ì Conventional systems (e.g., Subversion or “svn”)
have a centralized server hold the “master” copyì Distributed version control – each copy is its own
full-fledged master! (But you can still push changes from one person’s copy to another)ì Allows version control to work offlineì Allows version control to work with ad-hoc groups
Spring 2019Computer Systems and Networks
13
![Page 14: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/14.jpg)
Universe 1: Centralized Version Control (SVN)
Centralized Repository
svn commit
Ivan’s Dir Lisa’s Dir Kevin’s Dir Dorothy’s Dir
![Page 15: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/15.jpg)
Universe 2: Distributed Version Control (Hg)Centralized Repository
hg commit
Ivan’s Dir Lisa’s Dir Kevin’s Dir Dorothy’s Dir
Ivan’s Repo Lisa’s Repo Kevin’s Repo Dorothy’s Repo
hg pushhg pull
![Page 16: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/16.jpg)
Mercurial Command Flow (Typical)
1. hg clone <repository address> a. #get repo on your desktop
2. hg add <filenames> #always specify a filename to adda. #add new files and make changes
3. hg commit -m <meaningful commit message>a. #commit to your repob. Make changes and repeat 3
4. hg revert –alla. #if not happy with changes, revert to last commit (do 4)b. Then make changes and go to 3
5. hg push #All done? Let everyone see
![Page 17: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/17.jpg)
Problem 2 – Mercurial Cheat Sheet
ì Go find a Mercurial cheat sheet (or 2) for future reference
Spring 2019Computer Systems and Networks
17
P2
![Page 18: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/18.jpg)
Version Control in ECPE 170
ì Version control required for this classì Used to distribute boilerplate code for labsì Used to turn in assignments when finished
Spring 2019Computer Systems and Networks
18
![Page 19: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/19.jpg)
Version Control in ECPE 170
ì If you only do one check-in at the very end of your project, you've missed the whole point of version control, and turned a valuable tool into an obstacle to completing the assignment
ì Check-in code on aregular basis!
Spring 2019Computer Systems and Networks
19
![Page 20: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/20.jpg)
Spring 2019Computer Systems and Networks
20
![Page 21: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/21.jpg)
Spring 2019Computer Systems and Networks
21
http://xkcd.com/1597/
"If that doesn't fix it, git.txtcontains the phone number of a friend of mine who understands git. Just wait through a few minutes of 'It's really pretty simple, just think of branches as...' and eventually you'll learn the commands that will fix everything.”
![Page 22: Version Control · ìConventional systems (e.g., Subversion or “svn”) have a centralized server hold the “master” copy ìDistributed version control –each copy is its own](https://reader034.fdocuments.us/reader034/viewer/2022050517/5fa13a411f4af522244dd232/html5/thumbnails/22.jpg)
Problem 3 – Multiple Heads
ì Research and answer question 3 on your own, and then begin the lab!
Spring 2019Computer Systems and Networks
22
P3