![]() |
Chapter 3 | ![]() |
Alex sits down to code, and changes to his source code directory. He types "cvs update" to refresh his source code to the newest version. He decides that he'll be optimizing today - rewriting batches of code in many different parts of the system.
So he works for about 8 or 10 hours, and made some pretty major changes.
Convinced that his changes are good, he does a "cvs commit". No problem, the CVS system pops him into vi, he enters a short note about what he was doing, saves it and exits, and it tells him the commit is complete.
The next day, he does the same routine - "cvs update", sits down to code for a few hours, and goes to run "cvs commit" - but it fails. It informs him that his copy is out of date. Someone must have been working on one of the files he edited at the same time, and they committed their copy. According to the command output, the garbage.c file is out of date.
"Huh. Wonder what they were doing," Alex questions. Typing "cvs log garbage.c" he looks and sees that Sue made the last alteration, just five minutes ago - "Altered memory loop mark algorithm to detect nested, inaccessable loops, baring pointer arithmetic". That's nice.
So he types "cvs update" again. Sure enough it was the garbage.c file. Alex goes to compile the new code - making sure it works before he commits it, and it gives an error. Apparently he and the other programmer worked on the same area, and CVS inserted little marks showing where Alex would have to fix these conflicts.
These marks show up like this in the code..something most compilers won't accept as legal:
<<<<<<<<<<<<<<<<If Alex would have been paying attention, when he did the update he would have seen the "C" for conflict when the garbage.c file was updated. In anycase, Alex fixes the problem, compiles cleanly, and does a commit. Wallah!
old code
++++++++++++++++
new code
>>>>>>>>>>>>>>>>
![]() |
Index | ![]() |
3.2.6 Commonly Used Commands | 3.2.8 Additional CVS information |