Subversion, CVS, and many other version control systems use a copy-modify-merge model as an alternative to locking. In this model, each user’s client contacts the project repository and creates a personal working copy—a local reflection of the repository’s files and directories. Users then work simultaneously and independently, modifying their private copies. Finally, the private copies are merged together into a new, final version. The version control system often assists with the merging, but ultimately, a human being is responsible for making it happen correctly.
Here’s an example. Say that Harry and Sally each create working copies of the same project, copied from the repository. They work concurrently and make changes to the same file A within their copies. Sally saves her changes to the repository first. When Harry attempts to save his changes later, the repository informs him that his file A is out of date. In other words, file A in the repository has somehow changed since he last copied it. So Harry asks his client to merge any new changes from the repository into his working copy of file A. Chances are that Sally’s changes don’t overlap with his own; once he has both sets of changes integrated, he saves his working copy back to the repository. Figures 1-4 and 1-5 show this process.
Figure 1-4. The copy-modify-merge solution
Figure 1-5. The copy-modify-merge ...