June 9th, 2005
When you run update, it outputs information about
what has happened. For example, if there was nothing to update it
will just say “Success, CVS operation completed”. Normally,
however, files have either changed locally (i.e. you’ve changed
something) or in the repository (i.e. someone else has changed something)
– or both. In this case, update outputs a
line for each file, with a prefix that tells you what has happened.
In TortoiseCVS the different operations also each have a different
colour, which helps you to see at a glance what has happened (e.g.
conflicts are in red).
The output codes are as follows:
(Note: Thanks to bioperl.org
from which this is derived.)
- U file
- The local file has been updated to match the same file in the
CVS repository.
This is done for files that you haven’t changed but which
are not the most recent versions available in the repository.
It is also done if you update a directory and CVS finds a file
in the repository that is not in your working copy of the directory.
- M file
- Your local copy of the file has been modified since the previous
update.
M can indicate one of two things about the local
copy of the file:
- You’ve change the file locally, but there were no modifications
to the same file in the repository. In this case, CVS makes
no changes to either file, but the local file and the file
in the repository are now out of sync, so you will have to
commit the changes you have made.
- There were modifications in the repository as well as in
your local copy, but the changes in the repository file were
successfully merged into the local file, without any conflicts.
- C file
- A conflict was detected while trying to merge your changed version
of the file with the version in the repository. Generally this
happens because someone has committed changes to the repository
while you were working on a file. Usually you can avoid conflicts
by remembering to update a file before making any changes to it
– or if you are working on a file for a significant period
of time, save and update the file at regular intervals, and commit
any significant changes you make as often as you can (provided
you’re confident what you are committing is error free).
- A file
- This signifies that you have done a CVS add, to mark that this
new local file needs to be added to the repository, but you have
not yet committed the file’s parent directory, which is what
actually adds the file to the repository. Basically, it’s
a warning telling you that you need to commit the parent directory
to add this file.
- R file
- This signifies that you have done a CVS remove, to mark that
this local file should be removed from the repository, but you
have not yet committed the file’s parent directory, which
is what actually removes the file from the repository. Basically,
it’s a warning telling you that you need to commit the parent
directory to remove this file.
- ? file
- The file in your working copy of the directory does not exist
in the repository. Usually this means you’ve created a file
locally but not yet CVS added it and committed you change to the
directory. For example, if I edit a file called test.txt
using UltaEdit a test.txt.bak copy of the file
is always created in the directory. When I update the directory
this test.txt.bak file shows up in the output
as ? test.txt.bak.
-
Resolving conflicts
If you are using TortoiseCVS and there are conflicts, a dialog box
is displayed, listing the affected files:

When you double click a file, you can choose the diff program you
want to use to examine the conflicts. A message box then tells you
the names of two temporary files (a “mine” file and a
“yours” file) and tells you to change the “yours”
file when resolving the conflicts:

Scroll down through the files, looking for highlighted conflicts:
At this point you’re supposed to edit the “yours”
file, correcting the conflicts, then save your changes. However,
I’ve never managed to do this because I get a message saying
I can’t save the file to the current location. When you close
the diff program TortoiseCVS asks you if you want to overwrite the
unsuccessfully merged file with the “yours” file you’ve
just edited.
The alternative solution (if, like me, you can’t use the above
method), and the method used by Windows CVS users and UNIX CVS users
alike, is just to open up the local file in a text editor and resolve
the conflicts there. But first you need to be prepared for what you
find in the file CVS has attempted to merge.
For example, I created a text file called test.txt,
containing:
start
one two three
end
I saved this file, then added and committed it to the repository.
Someone else then changed the file to:
start
one xxx three
end
They then updated and committed their change. I still had my local
copy open and I changed it to:
start
one changedlocally three
end
I then saved the file and updated it, at which point I got a conflict
message. When I open the local copy of the file, I see:
start
<<<<<<< test.txt
one changedlocally three
=======
one xxx three
>>>>>>> 1.2
end
You need to edit the bit between the line containing <<<<<<<
and the line containing >>>>>>>. The line containing
======= separates your version (above) from the repository version
(below). You need to manually reconcile these two versions and then
remove the marker lines. Once you have done this and saved the file,
you can commit the resolved version.
Incidentally, whenever there's a conflict, your original, unmodified,
file is saved as .#filename.version.
For example, if the file is called test.txt, the
original file is saved as .#test.txt.1.1 or .#test.txt.1.2,
etc. – depending on what version of the file you’re working
on.
See http://bioperl.org/userinfo/cvsdoc/commands.html
for more information about CVS commands.
Potentially similar posts