Presentation on theme: "Version Control. Why version control? zScenario 1: yYour program is working yYou change "just one thing" yYour program breaks yYou change it back yYour."— Presentation transcript:
Why version control? zScenario 1: yYour program is working yYou change "just one thing" yYour program breaks yYou change it back yYour program is still broken--why? zHas this ever happened to you?
Why version control? (part 2) zYour program worked well enough yesterday zYou made a lot of improvements last night... y...but you haven't gotten them to work yet zYou need to turn in your program now zHas this ever happened to you?
Version control for teams zScenario: yYou change one part of a program--it works yYour co-worker changes another part--it works yYou put them together--it doesn't work ySome change in one part must have broken something in the other part yWhat were all the changes?
Teams (part 2) zScenario: yYou make a number of improvements to a class yYour co-worker makes a number of different improvements to the same class zHow can you merge these changes?
diff tools zThere are a number of tools that help you spot changes (differences) between two files Tools include diff, rcsdiff, jDiff, etc. zOf course, they won't help unless you kept a copy of the older version zDifferencing tools are useful for finding a small number of differences in a few files
jDiff jDiff is a plugin for the jEdit editor zAdvantages: yEverything is color coded yUses synchronized scrolling yIt's inside an editor--you can make changes directly zDisadvantages: Not stand-alone, but must be used within jDiff Just a diff tool, not a complete solution
Version control systems zA version control system (often called a source code control system) does these things: yKeeps multiple (older and newer) versions of everything (not just source code) yRequests comments regarding every change yAllows "check in" and "check out" of files so you know which files someone else is working on yDisplays differences between versions
sccs sccs is Source Code Control System (UNIX) sccs keeps multiple versions of a complete directory Storage requirements are small, because sccs : ykeeps the original documents ykeeps the changes needed to go from one version to the next ygenerates any version when you ask for it
rcs rcs is Revision Control System (also UNIX) rcs is like sccs, and does the same things, but sccs keeps the originals, and applies changes to get to newer versions rcs keeps the current versions, and applies changes to get back to older versions (opinion) You usually want to work with the newer versions, so rcs is usually the better choice
rcs commands Create a directory for your rcs files co -l file -- check out a file and lock it yLocking means you can check the file back in ci file -- check in a revision (put file under rcs) rcs -l file -- lock a file you already checked out (needed when you checked it out and forgot the -l ) rcsdiff files -- report differences between files merge files -- merges two files into original file yNot magic--you have to check the results
Who cares about UNIX? CVS is probably the most popular version control system on Windows CVS is based on rcs I don't know CVS very well CVS is built into JBuilder and CodeWarrior z"There are two ways to run CVS on Windows 95/NT. The first is as a client, talking to a CVS server on a Unix box. This is the recommended setup and is commonly used."
CVS commands zcvs checkout file zcvs commit file cvs diff file zBut these are CVS commands under UNIX! zPopular GUIs on Windows: ytkCVS yjCVS yWinCVS