So for the demo’s today you need to imagine three people getting involved
Revision control is the more generic term, used for source-control tools but also for other tools (Word, OpenOffice, ...). It references a version.Source Control offers revision control with branching and merging which are not always available in all revision tools (Word is not a Source Control, but offer revision control features)Version Control is a more general term than Source Control in that it manages version of anything (sources or binaries, or any kind of documents)
Backup and Restore. Files are saved as they are edited, and you can jump to any moment in time. Need that file as it was on Feb 23, 2007? No problem.Synchronization. Lets people share files and stay up-to-date with the latest version.Short-term undo.Monkeying with a file and messed it up? (That’s just like you, isn’t it?). Throw away your changes and go back to the “last known good” version in the database.Long-term undo. Sometimes we mess up bad. Suppose you made a change a year ago, and it had a bug. Jump back to the old version, and see what change was made that day.Track Changes. As files are updated, you can leave messages explaining why the change happened (stored in the VCS, not the file). This makes it easy to see how a file is evolving over time, and why.Track Ownership. A VCS tags every change with the name of the person who made it. Helpful for blamestorming giving credit.Sandboxing, or insurance against yourself. Making a big change? You can make temporary changes in an isolated area, test and work out the kinks before “checking in” your changes.Branching and merging. A larger sandbox. You can branch a copy of your code into a separate area and modify it in isolation (tracking changes separately). Later, you can merge your work back into the common are
Add: Put a file into the repo for the first time, i.e. begin tracking it with Version Control.Revision: What version a file is on (v1, v2, v3, etc.).Head: The latest revision in the repo.Check out: Download a file from the repo.Check in: Upload a file to the repository (if it has changed). The file gets a new revision number, and people can “check out” the latest one.
Checkin Message: A short message describing what was changed.Changelog/History: A list of changes made to a file since it was created.Update/Sync: Synchronize your files with the latest from the repository. This lets you grab the latest revisions of all files.Revert: Throw away your local changes and reload the latest version from the repository.
A1) No, you should use the TCP/IP connection to share repositories, but this is great for our labs today.A2) TortoiseSVN is a front end for the SVN client. The SVN client is a command line based tool.
A1) .r3 for revision 3 & .r4 for revision 4A2) Who ever checks in first will be fine. The second will get a commit, they will update but NOT get the conflict resolution files at it can auto merge. The second will need to then need to commit.
A1) Developer – the windows account
Branching Guidance– Scenario 1
Branching Guidance– Scenario 1
Same as scenario 1, but the advantage is that maintenance can occur very easily for a release
Use source control: Use it, duhDon’t break the build: Build or tree – when you check in you should not break the ability to build the code.Keep up to date: Try to keep your working set as close to repo version. The more you get out of date the greater the chance of a conflictAutomerge is a for Get ONLY: Some shit (sourcesafe) allow automerge on commitDon’t check in binaries: just cause you can store everything in the system, doesn’t mean you should. Binaries are especially badSeparate repo for separate things: Don;t try to have one super repo, try to seprate them.
Don’t delete: Why delete if you don’t need toWorking folders should be disposable: Your working folder should not become so valuable that you can’t afford to kill itUse non-working folders when needed: Most systems support a way to export WITHOUT repo information, use this for sharing code outside.Useful & meaningful messages: check in messages are important, use them wellDon’t use the audit trail to assign blame: using audit logs to assign blame is guarenteed to kill usageUse undo/revert sparingly Use undo/revert sparingly: You can trash your work easily, be careful
Use labels: Labels are easier to remember than changeset id’sBe light and quick with checkouts: Check out as little as possible and the check it in as quickly as possible.Try concurrent: Concurrent locking scares a lot of people but can give great productivity benefits, especially with thinking developers.Use Shelving: If you don’t have time to finish, remember to shelve
Don’t be afraid of branching: Like concurrent access it may seem to cause issues, but if you adopt it and use it responsibility then it will make your life great.Plan your branching strategy: Branching is tough – spend some time to plan aheadDon’t branch UNLESS you will look after it: Branches are like puppy’s you need to look after themTake responsibility for the merge: You need to devote time and plan your merge, then follow through with it.
Source Control 101
Source Control 101<br />
What are we doing?<br />Introduction<br />Lab 1<br /><ul><li>The file sharing way
Review</li></ul>Lab 2<br /><ul><li>Create repo, check in & check out
Disclaimer<br />The names and scenarios presented here are purely fictional. Any similarity to real people or scenarios is purely a coincidence.<br />No animals were harmed during the making of this bootcamp.<br />
Time to get a little crazy<br />You need to be three people today<br />Jim, the junior software dev.<br />Just out of his local computer school and hired by BB&D. Wrote code at school and home – by himself.<br />Simon, the “seasoned” software dev.<br />Ran his own software company for a few years - that created iPhone apps. Company size of 1.<br />Joined BB&D when Palm Pre killed the iPhone market.<br />Mike, the grizzly IT Pro. Wears shirts that say things like “There are 10 types of people, those who know binary and those who don’t.” <br />
Supporting cast<br />The wizard – fly’s in and does magic!<br />(used for stuff you need, but don’t care about)<br />The customer, is all about giving:<br />Gives you requirements.<br />Gives you headaches.<br />Gives you money.<br />
Create a file share and do some changes.<br />Time: 5min<br />
Now...<br />The customer needs a bug fixed in version 1<br />
Lab 2 - Review<br />Is this how you should do your repo?<br /> No, use the TCP/IP or SVN protocol.<br />What is TortoiseSVN?<br /> The SVN client is a command line tool.<br />TortoiseSVN is a wrapper for that.<br />
Jim: Update the file & check it in.<br />Simon: Sync and rollback.<br />Time: 5min<br />
Lab 3 - Review<br />Why did we have to commit again?<br /> Because there was a change<br />What revision are we now on?<br /> Revision 3<br />Can we get back to the code Jim put in, if we needed to?<br /> Yes<br />
Jim: Change the file<br />Simon: Change the file<br />CONFLICT!!<br />Time: 10min<br />
Lab 4 - Review<br />Why did we have a .r3 and .r4 file?<br /> revision 3 & revision 4<br />What would happen if this was the changes and we tried to commit?<br /> It would auto merge<br />Jim<br />Simon<br />
Simon: wants to do a major code change and make sure Jim doesn’t mess with him<br />Time: 5min<br />
Lab 5 - Review<br />Who locked the file?<br /> Developer, the user logged into Windows<br />What happens if the person who locked the file goes on holiday?<br /> You can break the lock if needed.<br />
Simon: As they are releasing version 1 they want to make sure they can fix issues while working on v2.<br />Time: 10min<br />
Lab 6 - Review<br />Do we need to switch?<br /> No, but it helps keep focus and prevent issues across branches.<br />
Lab 6 - Review<br />What is shelving?<br />Shelving is branching to a personal temporary branch.<br />Why shelve?<br />Interruptions: Pending changes that are not ready for check in.<br />Integration/Handoff: Sharing code with someone else, without a check in.<br />Review: Code for review<br />Backup: Personal backup<br />
Lab 6 - Review<br />How to shelve?<br />Create a new root folder named shelve, as we did for branches.<br />In that a folder for each user.<br />Branching as normal.<br />
Scenario #1: Single Team Branching Model<br />Nightly Build<br />(Early Validation)<br />All dev done on branch<br />CI / Nightly Builds<br />(Early validation)<br />V1.2<br />V1.1 (start)<br />V1.1 FT3<br />DEV<br />3<br />4<br />5<br />8<br />RI<br />RI<br />FI<br />FI<br />FI<br />Branch<br />V1.1<br />V1.2<br />1<br />2<br />6<br />7<br />MAIN<br />V1.1 (bug fix)<br />V1.0<br />Production<br />Main should be very stable<br />
Scenario #2: Concurrent Hot Fix, Service Pack, and v.Next<br />2<br />DEV …<br />The two DEV branches are created as sequential tasks, but as one unit of work.<br />All dev done on branches<br />2<br />DEV-1<br />Branch<br />MAIN<br />1<br />Branch<br />Branch<br />FI<br />R1 (SP)<br />R2 (SP)<br />6<br />SERVICE PACK<br />3<br />Branch<br />Branch<br />When MAIN is ready to release, create the SERVICE PACK, HOT FIX, and RELEASE branches at the same time.<br />Branch<br />R1 (SP0)<br />R1 (SP1)<br />R2 (SP0)<br />4<br />7<br />HOT FIX<br />Branch<br />Branch<br />Branch<br />R1 (SP0)<br />R1 (SP1)<br />R2 (SP0)<br />5<br />8<br />RTM<br />The RTM branch is a read-only copy of what was released<br />These should be read only<br />
Scenario #3: Branching and Labeling<br />The two DEV branches are created as sequential tasks, but as one unit of work.<br />TEST …<br />6<br />TEST-1<br />5<br />Branch<br />V1.2<br />Release labels in branch<br />DEV …<br />2<br />4<br />Branch<br />V1.1<br />DEV-1<br />2<br />3<br />Branch<br />1<br />MAIN<br />Main is just the latest<br />
Simon: Needs to make sure v2 gets the same bug fix as v1 had.<br />Time: 5min<br />
Lab 7 - Review<br />Branch v1<br />Conflict<br />Merge<br />Trunk<br />No cartoons, cause this is too hard to show with cartoons.<br />
WARNING<br />The tools to be presented next are based on some personal use and discussion.<br />They could break or not work – please consultant us and test prior to adoption.<br />
IDE Integration<br />http://ankhsvn.open.collab.net/<br />Free & Open Source<br />http://www.pushok.com/soft_svn.php<br />Costs ($27) & Proprietary<br />& about a billion other SVN clients ;)<br />