Java Reference
In-Depth Information
Kwan goes to commit his modified version of Account.java to the repository,
he is notified that Account.java has been changed since his copy was checked
out, and the commit attempt fails. So Kwan does an update which merges the
1.8 version of Account.java in with his modified 1.7 version. If all goes well,
the resulting file will be a 1.8 version of Account.java which includes Kwan's
new changes in the right place(s). Kwan just commits this to the repository,
and Account.java then stands at version 1.9.
Note that cautionary phrase “if all goes well.” The merge will work if Ti
and Kwan have each modified different parts of the same file. If all Kwan did
was add a new method, it would merge just fine. But what if they both make
changes in the same region of the source file? It is up to the programmer to
resolve such conflicts and commit the source once again.
In such a situation, CVS does what it can to help out. There is an example
of a merge conflict later in this chapter. But such conflicts require human
intervention.
Merging of conflicts is, undoubtedly, a very manual process, but you will
be surprised by how infrequently you need to do this. Most changes will be
merged clean with no manual intervention required. That's probably because
most often, when two or more programmers are modifying the same file, they
are modifying different sections of it.
With merging, you have the ability to incorporate other developer's
changes into your version of the source without the fear of losing your changes.
No one's changes get lost, no one's files get “stepped on.”
8.2.1
Before you can use CVS to track your sources, you need to initialize a reposito-
ry. You can use this repository for several different projects, so you only need
to do this setup once.
There are two different ways to connect to a repository—directly on a
filesystem, or indirectly over a network. We will use the simpler filesystem
mechanism for this discussion. The network connections are described in the
references at the end of this chapter.
In order for CVS to know where the repository is located and how to
connect to it, it looks for an environment variable called CVSROOT . You can
assign a value to CVSROOT from the command line each time you create a CVS
project, or for more convenience, you can set it in the shell startup script
(e.g., .bashrc ) so that its ready all the time. The CVSROOT value is really only
Setup
Search WWH ::




Custom Search