|
Modelling clouds and climate |
Making changes and updating |
| Path: Contents > Using CVS > Making changes and updating | |
|
Site Map
Contents About CVS Terminology Using CVS (import) (checkout) (update/diff) (commit) (release) Other CVS Commands (log) (add/del) Spetial Topics References Web Contact: Phil Austin Site created with Cheetah. Last updated: Mar 13 2003 |
Making and Merging your changescvs update (synonyms: up upd) Since you will be using your own working directory, the changes you make to your working directory aren't automatically visible to the other developers on the team. CVS doesn't publish your changes until you're ready. When you're done testing your changes, you must commit them to the repository to make them available to the rest of the group. However, what if another developer has changed the same files you have, or the same lines? Whose changes should prevail? It's generally impossible to answer this question automatically; CVS certainly isn't competent to make that judgment. Thus, before you can commit your changes, CVS requires your sources to be in sync with any changes committed by the other team members. Update Command is used to do this. You have to be in your working directory to call update UpdateIt compares the overall state of the working copy with the state of the project in the repository. Even if nothing in the repository has changed since checkout, something in the working copy may have, and update will show that, too: $ cvs update cvs update: Updating . U scm_parm.F $ A line of the form `U file' means that file was simply Updated; someone else had made a change to the file, you haven't, and CVS copied the modified file into your home directory. ModifyHere is an exmaple of a case where two people were working on the same file but on different parts so there is no textual conflicts: $ cvs update cvs update: Updating . RCS file: /nfs/roc/home/cvs/scm/scm_parm.F,v retrieving revision 1.1 retrieving revision 1.2 Merging differences between 1.1 and 1.2 into scm_parm.F M scm_parm.F $ This indicates that someone else has
changed `scm_parm.F'; CVS merged their changes
with yours, and did not find any textual conflicts. The
numbers `1.1' and Note that CVS merges changes into your working copy only; the repository and the other developers' working directories are left undisturbed. It is up to you to test the merged text. A line of the form `M file' means that file has been Modified by you, and contains changes that are not yet visible to the other developers. These are changes you need to commit. In this case, `scm_parm.F' now contains both your modifications and those of the other user. Since CVS has merged someone else's changes into your source, it's best to make sure things still work. ConflictHere is an exmaple of a case where two people were working on the same file but on the same parts so there is some textual conflicts: $ cvs update cvs update: Updating . RCS file: /nfs/roc/home/cvs/scm/scm_parm.F,v retrieving revision 1.1 retrieving revision 1.2 rcsmerge: warning: conflicts during merge cvs update: conflicts found in scm_parm.F C scm_parm.F $ This indicates that someone else has changed `scm_parm.F'; CVS merged their changes with yours, and found some textual conflicts. A line of the form `C file' means that file has a Conflict. All the rules as if there was no conflict apply here except that the contents of scm_parm.F now shows both changes and you have to go manualy and resolv the conflict. This is usually done by talking to the other users of ubcscm to see what the conflict is about. DiffSometimes, merely knowing which files you've edited is all you need. However, if you want a more detailed look at the changes, you can get a full report in diff format. The diff command compares the possibly modified files in the working copy to their counterparts in the repository and displays any differences:
$ cvs diff
cvs diff: Diffing .
Index: scm_parm.F
===================================================================
RCS file: /nfs/roc/home/cvs/scm/scm_parm.F,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 scm_parm.F
6a7
> printf ("Goodbye, world!\n");
Diff command has a lot of useful features and different ways to list the merges and conflicts. Other Examples:Switch to a working copy with a specific tag. Tag is used like a version number $ cvs update -r some_release ubcscm |