| | #include <stdio.h>
int main(int argc,
char **argv)
{
parse();
if (argc != 1)
{
fprintf(stderr, "tc: No args exeporg>
Send bugs and suggestions to
-->
CVS--Concurrent Versions System v1.12.13: 10. Multiple developers
10. Multiple developers
When more than one person works on a software project
things often get complicated. Often, two people try to
edit the same file simultaneously. One solution, known
as file locking or reserved checkouts, is
to allow only one person to edit each file at a time.
This is the only solution with some version control
systems, including RCS and SCCS. Currently
the usual way to get reserved checkouts with CVS
is the cvs admin -l command (see section admin options). This is not as nicely integrated into
CVS as the watch features, described below, but it
seems that most people with a need for reserved
checkouts find it adequate.
As of CVS version 1.12.10, another technique for getting most of the
effect of reserved checkouts is to enable advisory locks. To enable advisory
locks, have all developers put "edit -c", "commit -c" in their
.cvsrc file, and turn on watches in the repository. This
prevents them from doing a cvs edit if anyone is
already editting the file. It also may
be possible to use plain watches together with suitable
procedures (not enforced by software), to avoid having
two people edit at the same time.
The default model with CVS is known as
unreserved checkouts. In this model, developers
can edit their own working copy of a file
simultaneously. The first person that commits his
changes has no automatic way of knowing that another
has started to edit it. Others will get an error
message when they try to commit the file. They must
then use CVS commands to bring their working copy
up to date with the repository revision. This process
is almost automatic.
CVS also supports mechanisms which facilitate
various kinds of communication, without actually
enforcing rules like reserved checkouts do.
The rest of this chapter describes how these various
models work, and some of the issues involved in
choosing between them.
10.1 File status
Based on what operations you have performed on a
checked out file, and what operations others have
performed to that file in the repository, one can
classify a file in a number of states. The states, as
reported by the status command, are:
-
- Up-to-date
The file is identical with the latest revision in the
repository for the branch in use.
- Locally Modified
-
You have edited the file, and not yet committed your changes.
- Locally Added
-
You have added the file with add, and not yet
committed your changes.
- Locally Removed
-
You have removed the file with remove, and not yet
committed your changes.
- Needs Checkout
-
Someone else has committed a newer revision to the
repository. The name is slightly misleading; you will
ordinarily use update rather than
checkout to get that newer revision.
- Needs Patch
-
Like Needs Checkout, but the CVS server will send
a patch rather than the entire file. Sending a patch or
sending an entire file accomplishes the same thing.
- Needs Merge
-
Someone else has committed a newer revision to the repository, and you
have also made modifications to the file.
- Unresolved Conflict
-
A file with the same name as this new file has been added to the repository
from a second workspace. This file will need to be moved out of the way
to allow an update to complete.
- File had conflicts on merge
-
This is like Locally Modified, except that a previous
update command gave a conflict. If you have not
already done so, you need to
resolve the conflict as described in Conflicts example.
- Unknown
-
CVS doesn't know anything about this file. For
example, you have created a new file and have not run
add.
To help clarify the file status, status also
reports the Working revision which is the
revision that the file in the working directory derives
from, and the Repository revision which is the
latest revision in the repository for the branch in
use.
The `Commit Identifier' reflects the unique commitid
of the commit.
The options to status are listed in
Quick reference to CVS commands. For information on its Sticky tag
and Sticky date output, see Sticky tags.
For information on its Sticky options output,
see the `-k' option in update options.
You can think of the status and update
commands as somewhat complementary. You use
update to bring your files up to date, and you
can use status to give you some idea of what an
update would do (of course, the state of the
repository might change before you actually run
update). In fact, if you want a command to
display file status in a more brief format than is
displayed by the status command, you can invoke
The `-n' option means to not actually do the
update, but merely to display statuses; the `-q'
option avoids printing the name of each directory. For
more information on the update command, and
these options, see Quick reference to CVS commands.
10.2 Bringing a file up to date
When you want to update or merge a file, use the cvs update -d
command. For files that are not up to date this is roughly equivalent
to a checkout command: the newest revision of the file is
extracted from the repository and put in your working directory. The
-d option, not necessary with checkout, tells CVS
that you wish it to create directories added by other developers.
Your modifications to a file are never lost when you
use update. If no newer revision exists,
running update has no effect. If you have
edited the file, and a newer revision is available,
CVS will merge all changes into your working copy.
For instance, imagine that you checked out revision 1.4 and started
editing it. In the meantime someone else committed revision 1.5, and
shortly after that revision 1.6. If you run update on the file
now, CVS will incorporate all changes between revision 1.4 and 1.6 into
your file.
If any of the changes between 1.4 and 1.6 were made too
close to any of the changes you have made, an
overlap occurs. In such cases a warning is
printed, and the resulting file includes both
versions of the lines that overlap, delimited by
special markers.
See section update--Bring work tree in sync with repository, for a complete description of the
update command.
10.3 Conflicts example
Suppose revision 1.4 of `driver.c' contains this:
| | #include <stdio.h>
void main()
{
parse();
if (nerr == 0)
gencode();
else
fprintf(stderr, "No code generated.\n");
exit(nerr == 0 ? 0 : 1);
}
|
Revision 1.6 of `driver.c' contains this:
| | #include <stdio.h>
int main(int argc,
char **argv)
{
parse();
if (argc != 1)
{
fprintf(stderr, "tc: No args exeporg>
Send bugs and suggestions to
-->
CVS--Concurrent Versions System v1.12.13: 10. Multiple developers
10. Multiple developers
When more than one person works on a software project
things often get complicated. Often, two people try to
edit the same file simultaneously. One solution, known
as file locking or reserved checkouts, is
to allow only one person to edit each file at a time.
This is the only solution with some version control
systems, including RCS and SCCS. Currently
the usual way to get reserved checkouts with CVS
is the cvs admin -l command (see section admin options). This is not as nicely integrated into
CVS as the watch features, described below, but it
seems that most people with a need for reserved
checkouts find it adequate.
As of CVS version 1.12.10, another technique for getting most of the
effect of reserved checkouts is to enable advisory locks. To enable advisory
locks, have all developers put "edit -c", "commit -c" in their
.cvsrc file, and turn on watches in the repository. This
prevents them from doing a cvs edit if anyone is
already editting the file. It also may
be possible to use plain watches together with suitable
procedures (not enforced by software), to avoid having
two people edit at the same time.
The default model with CVS is known as
unreserved checkouts. In this model, developers
can edit their own working copy of a file
simultaneously. The first person that commits his
changes has no automatic way of knowing that another
has started to edit it. Others will get an error
message when they try to commit the file. They must
then use CVS commands to bring their working copy
up to date with the repository revision. This process
is almost automatic.
CVS also supports mechanisms which facilitate
various kinds of communication, without actually
enforcing rules like reserved checkouts do.
The rest of this chapter describes how these various
models work, and some of the issues involved in
choosing between them.
10.1 File status
Based on what operations you have performed on a
checked out file, and what operations others have
performed to that file in the repository, one can
classify a file in a number of states. The states, as
reported by the status command, are:
-
- Up-to-date
The file is identical with the latest revision in the
repository for the branch in use.
- Locally Modified
-
You have edited the file, and not yet committed your changes.
- Locally Added
-
You have added the file with add, and not yet
committed your changes.
- Locally Removed
-
You have removed the file with remove, and not yet
committed your changes.
- Needs Checkout
-
Someone else has committed a newer revision to the
repository. The name is slightly misleading; you will
ordinarily use update rather than
checkout to get that newer revision.
- Needs Patch
-
Like Needs Checkout, but the CVS server will send
a patch rather than the entire file. Sending a patch or
sending an entire file accomplishes the same thing.
- Needs Merge
-
Someone else has committed a newer revision to the repository, and you
have also made modifications to the file.
- Unresolved Conflict
-
A file with the same name as this new file has been added to the repository
from a second workspace. This file will need to be moved out of the way
to allow an update to complete.
- File had conflicts on merge
-
This is like Locally Modified, except that a previous
update command gave a conflict. If you have not
already done so, you need to
resolve the conflict as described in Conflicts example.
- Unknown
-
CVS doesn't know anything about this file. For
example, you have created a new file and have not run
add.
To help clarify the file status, status also
reports the Working revision which is the
revision that the file in the working directory derives
from, and the Repository revision which is the
latest revision in the repository for the branch in
use.
The `Commit Identifier' reflects the unique commitid
of the commit.
The options to status are listed in
Quick reference to CVS commands. For information on its Sticky tag
and Sticky date output, see Sticky tags.
For information on its Sticky options output,
see the `-k' option in update options.
You can think of the status and update
commands as somewhat complementary. You use
update to bring your files up to date, and you
can use status to give you some idea of what an
update would do (of course, the state of the
repository might change before you actually run
update). In fact, if you want a command to
display file status in a more brief format than is
displayed by the status command, you can invoke
The `-n' option means to not actually do the
update, but merely to display statuses; the `-q'
option avoids printing the name of each directory. For
more information on the update command, and
these options, see Quick reference to CVS commands.
10.2 Bringing a file up to date
When you want to update or merge a file, use the cvs update -d
command. For files that are not up to date this is roughly equivalent
to a checkout command: the newest revision of the file is
extracted from the repository and put in your working directory. The
-d option, not necessary with checkout, tells CVS
that you wish it to create directories added by other developers.
Your modifications to a file are never lost when you
use update. If no newer revision exists,
running update has no effect. If you have
edited the file, and a newer revision is available,
CVS will merge all changes into your working copy.
For instance, imagine that you checked out revision 1.4 and started
editing it. In the meantime someone else committed revision 1.5, and
shortly after that revision 1.6. If you run update on the file
now, CVS will incorporate all changes between revision 1.4 and 1.6 into
your file.
If any of the changes between 1.4 and 1.6 were made too
close to any of the changes you have made, an
overlap occurs. In such cases a warning is
printed, and the resulting file includes both
versions of the lines that overlap, delimited by
special markers.
See section update--Bring work tree in sync with repository, for a complete description of the
update command.
10.3 Conflicts example
Suppose revision 1.4 of `driver.c' contains this:
| | #include <stdio.h>
void main()
{
parse();
if (nerr == 0)
gencode();
else
fprintf(stderr, "No code generated.\n");
exit(nerr == 0 ? 0 : 1);
}
|
Revision 1.6 of `driver.c' contains this:
| | #include <stdio.h>
int main(int argc,
char **argv)
{
parse();
if (argc != 1)
{
fprintf(stderr, "tc: No args exeporg>
Send bugs and suggestions to
-->
CVS--Concurrent Versions System v1.12.13: 10. Multiple developers
10. Multiple developers
When more than one person works on a software project
things often get complicated. Often, two people try to
edit the same file simultaneously. One solution, known
as file locking or reserved checkouts, is
to allow only one person to edit each file at a time.
This is the only solution with some version control
systems, including RCS and SCCS. Currently
the usual way to get reserved checkouts with CVS
is the cvs admin -l command (see section admin options). This is not as nicely integrated into
CVS as the watch features, described below, but it
seems that most people with a need for reserved
checkouts find it adequate.
As of CVS version 1.12.10, another technique for getting most of the
effect of reserved checkouts is to enable advisory locks. To enable advisory
locks, have all developers put "edit -c", "commit -c" in their
.cvsrc file, and turn on watches in the repository. This
prevents them from doing a cvs edit if anyone is
already editting the file. It also may
be possible to use plain watches together with suitable
procedures (not enforced by software), to avoid having
two people edit at the same time.
The default model with CVS is known as
unreserved checkouts. In this model, developers
can edit their own working copy of a file
simultaneously. The first person that commits his
changes has no automatic way of knowing that another
has started to edit it. Others will get an error
message when they try to commit the file. They must
then use CVS commands to bring their working copy
up to date with the repository revision. This process
is almost automatic.
CVS also supports mechanisms which facilitate
various kinds of communication, without actually
enforcing rules like reserved checkouts do.
The rest of this chapter describes how these various
models work, and some of the issues involved in
choosing between them.
|
|
|